ProjectEvergreen / ProjectEvergreen/wcc

Form Controls for JSX

Open
#89 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

expirement feature JSX
Dominant language
JavaScript
Stars
126
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Type of Change

  • New Feature Request

Summary

Would like to support these kinds of features

  1. Boolean Attributes
  2. Form Submission

Details

Boolean Attributes

Like a checked attribute

render() {
  const { completed, task } = this.todo;
  const checked = completed ? 'checked' : '';

  return (
    <input class="complete-todo" type="checkbox" checked/>
  );
}

To my knowledge, JSX does not support this syntax

<input type="checkbox" {isChecked} />
Form Submission

Would like be able to do something like this

class Todo extends HTMLElement {
  addTodo(e) {
    e.preventDefault();
    ...

    this.render();
  }

  render() {
    return 
      <form onsubmit={this.addTodo}>
        <input class="todo-input" type="text" placeholder="Food Shopping" required/>
        <button class="add-todo" type="button" onclick={this.addTodo}>+ Add</button>
      </form>
    );
  }
}

Right now it works, but by accident I think, and seeing this error in the console
Screen Shot 2022-08-02 at 3 30 58 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are identified. Start by reproducing the Boolean Attributes and Form Submission JSX examples, then trace how JSX is compiled and how the generated form controls behave. Done should include deliberate support for the requested behavior without the reported console error, with tests covering both features.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.