Skip to content

Explore a <DisabledWrapper> component - #38

Draft
Pjaerr wants to merge 1 commit into
mainfrom
disabled-wrapper-component
Draft

Explore a <DisabledWrapper> component#38
Pjaerr wants to merge 1 commit into
mainfrom
disabled-wrapper-component

Conversation

@Pjaerr

@Pjaerr Pjaerr commented Feb 16, 2026

Copy link
Copy Markdown
Member

If your tooltipper is a disabled element, the tooltip will not show for keyboard users (as you can't focus a disabled element), or in a test suite with simulated mouseenter events for the same reason.

This PR explores the addition of a <DisabledWrapper> component that provides a wrapper acting as a fake element that is focusable. In this scenario the wrapper is the tooltipper, not the disabled element. When the element is not disabled, then the wrapper just acts as an empty div.

Note that I've had to adjust the focus events to check for focusin and focusout as if a button is not disabled, but is wrapped with <DisabledWrapper>, we don't want to force the user to have to tab twice to get to the button, this change means the wrapper will remain the tooltipper, just not focusable, instead reacting to the bubbling focus event from the button. I'm not too sure on whether this is the right approach, or if there are any knock on effects 馃

Note that there are no tests for this functionality yet. This is just exploring it.

@Pjaerr Pjaerr self-assigned this Feb 16, 2026
@Pjaerr

Pjaerr commented Feb 16, 2026

Copy link
Copy Markdown
Member Author

@amk221 No rush, but I just had a quick play with what a wrapper element could look like to solve this problem. What do you think to this approach?

I think the name of the component could be better but I guess it's purpose is very descriptive as <DisabledWrapper>. I've also made it take a @disabled arg, instead of automatically figuring out if the direct child is disabled.

@amk221
amk221 force-pushed the main branch 2 times, most recently from a286490 to 1a30049 Compare April 24, 2026 14:09
@amk221
amk221 force-pushed the main branch 3 times, most recently from efd43fc to 8ed7753 Compare June 23, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant