-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Can't use triggerEvent
on a disabled element
#1187
Comments
I've created a quick reproduction https://codepen.io/ro0gr/pen/qBVdRoo, and I'm really surprised that However, there is a bit inconsitent behavior between browsers. In case of Firefox, a button is able to handle Can you elaborate more on your exact use case please? Is it a custom tooltip element(cause I don't think it's possible to test native tooltips appearance)? Which events does your tooltip rely on? |
Thanks @ro0gr, sure - an example of our use case looks something like: <TooltipDecorator @tooltipText="bla" @showTooltip={{true}}>
<button disabled={{@disabled}}>hello</button>
</TooltipDecorator> So basically, we have this re-usable component which we wrap around elements to add a tooltip to them. In this case the button element itself doesn't have a tooltip, but rather, hovering it causes the tooltip on the parent wrapping The implementation of {{#if @showTooltip}}
<span
data-test-tooltip-decorator-tooltip
aria-label={{translate-newlines @tooltipText}}
class="tooltip {{@verticalPosition}}"
...attributes
>
{{yield}}
</span>
{{else}}
{{yield}}
{{/if}} One workaround is that I could hover the decorator instead of the button - but that feels a bit too close to testing an implementation detail and I'd prefer to just trigger a
Looking at the code above, seems there is no JS used to display the tooltip and instead it uses |
👋 From an accessibility perspective, if an interactive element is disabled, a |
Now I see, it's probably achieved via So, if I don't miss smth, interacting with a |
@ro0gr how would you access it as a keyboard-only user? |
@MelSumner sorry, not sure if I follow your question, but as a keyboard user I'd probably use Tab or vim flavoured keybindings. I mean I approach this issue from the low level testing perspective.
as I can see now, there is still no point to make it less restrictive, cause I can not see any practical value for it. |
Adding to the discussion, I believe Beyond known events, there's also the case of Maintaining a comprehensive list of forbidden or allowed events might not be practical or sustainable. However, I suggest providing testers with an option to trigger events on disabled elements if necessary. For instance, a Proposed PR #1521. |
I'm trying to test that a disabled button displays a tooltip when hovered, but it seems that
triggerEvent
won't allow this.Seems this rule is overly strict?
The text was updated successfully, but these errors were encountered: