-
Notifications
You must be signed in to change notification settings - Fork 77
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: ensure components are disabled consistently #4109
fix: ensure components are disabled consistently #4109
Conversation
Figured out why Screener checks weren't working with #4010 and #4108. A new E2E util I added, introduced an import from |
This PR is now stable, so pardon for the modified copypasta from #4010 😅: @benelan @y0n4 Can you help me test this out? Some things to look out for:
@macandcheese @asangma Can you take a look at the Screener diffs? 👀 |
yup I'll do that tomorrow! |
I believe this is working as expected. The disabled element is the radio and not the label in this case. |
@y0n4 Thanks! I'll take a look at fixing the value-list. Pick-list may also have the same issue since they share code. |
@y0n4 Could you share more info on the <calcite-value-list disabled>
<calcite-value-list-item label="Uno" removable value="1"></calcite-value-list-item>
<calcite-value-list-item label="Dos" value="2" removable selected></calcite-value-list-item>
<calcite-value-list-item label="Tres" value="3" removable></calcite-value-list-item>
</calcite-value-list> |
Sorry yes I failed to mention that it was the
<calcite-value-list>
<calcite-value-list-item disabled label="Uno" removable value="1"></calcite-value-list-item>
<calcite-value-list-item label="Dos" value="2" removable selected></calcite-value-list-item>
<calcite-value-list-item label="Tres" value="3" removable></calcite-value-list-item>
</calcite-value-list> |
@y0n4 The value-list issue you reported should now be fixed. Can you test again? |
@jcfranco just tested and value-list-item works great! Thank you |
Last round of fixes installed. Checks are ✅! @macandcheese Accepted the following Screener changes per our discussion a while back. cc @asangma Let me know if we need to revisit any of these later on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Related Issue: #2655
Summary
This establishes a pattern to handle the disabling of interactive components.
Implementation of interactive components should follow these steps:
InteractiveComponent
interface.updateHostInteraction
(src/utils/interactive.ts
) on the component'scomponentDidRender
lifecycle method – this will updatetabindex
andaria-disabled
attributes, accordingly.disabled
mixin fromsrc/assets/styles/includes.scss
– this provides the base styles for disabled components.disabled
on any supporting, internal components (e.g.,<calcite-slider>
disables internal<button>
s).disabled
test helper (src/tests/commonTests
).Notes
disabled components set
tabIndex
on the host and assume it will not be modified by end-users - it is set on the host to prevent tabbing into children:From WICG/inert#48:
disabling a component with an active popover will close it and prevent programmatically opening it
calcite-label
'sdisabled
property is deprecatedtweaked styles and rendering of
calcite-input-date-picker
to avoid pointer-events overrides.programmatically disabling a component that owns focus will not affect the focus order. For example, if the color picker's hex input is focused and some extraneous code disables the color picker, a user would still be able to tab within the the color picker's focusable controls. I think this won't be feasible in a performant way until
inert
is implemented across browsers. FWIW, I don't think this will be an issue for most use cases, but we'll have to see. As a workaround, endusers could focus another element when disabling a focus-owning component.Some components emit one or more click events from implementation, I'll create a separate issue for this.
Disabled components get their
HTMLElement#click()
hijacked to prevent programmatic clicking.The following components were updated to follow the same
disabled
behavior:calcite-action.tsx
calcite-block.tsx
calcite-button.tsx
calcite-checkbox.tsx
calcite-color-picker.tsx
calcite-combobox-item.tsx
calcite-combobox.tsx
calcite-date-picker-day.tsx
calcite-dropdown.tsx
calcite-fab.tsx
calcite-filter.tsx
calcite-inline-editable.tsx
calcite-input-date-picker.tsx
calcite-input-time-picker.tsx
calcite-input.tsx
calcite-link.tsx
calcite-list-item.tsx
calcite-list.tsx
calcite-panel.tsx
calcite-pick-list.tsx
calcite-radio-button.tsx
calcite-radio-group.tsx
calcite-rating.tsx
calcite-select.tsx
calcite-slider.tsx
calcite-sortable-list.tsx
calcite-split-button.tsx
calcite-stepper-item.tsx
calcite-switch.tsx
calcite-tab-title.tsx
calcite-tile-select.tsx
calcite-tile-select-group.tsx
calcite-tile.tsx
calcite-value-list.tsx
Pending
Questions
calcite-label
needdisabled
? Is it considered interactive? It only forwards the click on labelable components. – will deprecate as disabled label behavior depends on labelable componentcalcite-stepper
to keep overriding pointer events on items to display the disabled (not-allowed
) cursor?– the pointer-events override & custom cursor will be removed for consistency