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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit and clean up firing of click events on disabled components #2112

Open
jattasNI opened this issue May 15, 2024 · 0 comments
Open

Audit and clean up firing of click events on disabled components #2112

jattasNI opened this issue May 15, 2024 · 0 comments

Comments

@jattasNI
Copy link
Contributor

jattasNI commented May 15, 2024

馃Ч Tech Debt

In this SLE PR switching from click events to change events for menu items, we noticed that the click event fires even if the menu is disabled. This appears to be misaligned with how native elements behave. We should visit each of our components and ensure they behave as expected.

Expected behavior

There is a very long discussion of expected behavior on this whatwg issue: whatwg/html#5886

My understanding of the summary is:
For form controls that are disabled:

  1. if you click on non-disabled child elements, that content should receive the click event
  2. regardless of whether you click on child content or the element itself, the element should not receive the click event
  3. regardless of whether you click on child content or the element itself, parent elements should not receive the click event

And obviously any other documented side effects of clicking the component should not happen when it's disabled (e.g. menu items shouldn't fire change, links shouldn't navigate, etc). (Hopefully this works already)

Elements to audit and fix

I limit this to elements that have a click interaction. We might narrow the

Component Audit Status Implementation Status
Anchor
Anchor Button
Anchor Tabs
Banner no click interaction / disabled state
Breadcrumb
Button
Card Button
Checkbox
Combobox (and list option)
Dialog no click interaction / disabled state
Icons no click interaction / disabled state
Menu / Menu Item / Menu Button click event fires on the menu item when disabled
Number Field
Radio Group
Select (and list option)
Spinner no click interaction / disabled state
Switch
Table need to think through which parts of this the guidance would apply to
Tabs
Text Area
Text Field
Toggle Button
Toolbar no click interaction / disabled state
Tree (and tree item)
@jattasNI jattasNI added tech debt triage New issue that needs to be reviewed labels May 15, 2024
@m-akinc m-akinc removed the triage New issue that needs to be reviewed label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants