Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checkbox trigger specifier when used with checkboxes #2896

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

jsonn
Copy link
Contributor

@jsonn jsonn commented Sep 11, 2024

Description

Unlike other form elements, checkbox elements will return on whether or not they are currently ticked. Explicitly handle this by checking for the tag name and type and then use the checked property.

Testing

A new test case is included, failing before.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

Note: this PR is on top of #2893

The `changed` trigger modifier can see different event targets, either due
to the `from` modifier or event bubbling. The existing behavior trigger
only for one node (`from` modifier) or inconsistently (bubbling).

Use a nested weak map to keep track of the last value per distinguished
(trigger specification, event target node) pair. The weak map ensures
that Garbage Collection can still recycle the nodes.

If a event target was not seen via `from`, it is assumed changed for the
first time the trigger is hit.
<input type="checkbox"> is special in that it shows up with a value of
"on", even if it is not checked. Introduce a helper function for getting
the effective value of a node by handling this pecularity.
@jsonn jsonn changed the base branch from master to dev September 11, 2024 22:59
@Telroshan Telroshan added bug Something isn't working under discussion Issues that are being considered but require further alignment labels Sep 12, 2024
@Telroshan
Copy link
Collaborator

Note: I'm labelling this as "under discussion" until #2891 is processed, as the latter includes some changes that this PR depends on.
If and when #2891 is merged in, this PR's diff will be smaller thus easier to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working under discussion Issues that are being considered but require further alignment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants