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

Arbitrarily freeze what-intent while focused #123

Open
warkentien2 opened this issue Mar 14, 2022 · 2 comments
Open

Arbitrarily freeze what-intent while focused #123

warkentien2 opened this issue Mar 14, 2022 · 2 comments

Comments

@warkentien2
Copy link

Hi, @ten1seven

I would like to extend the Form field behavior — of a frozen what-intent while focused — to other elements.
At first, I created a hook, as you showed in #105.
But, it could be as simple as adding a data attribute, e.g.:

Updating:

const formInputs = ['button', 'input', 'select', 'textarea'];

to:

const formInputs = ['button', 'input', 'select', 'textarea', '[data-whatintent-target]'];
// usage
<RangeInputHandle data-whatintent-target />

Also, it would be great if [data-whatintent-target] didn't have to be inside a <form>.

Use case:
When controlling a video player by clicking the progress slider and then clicking the left and right arrows,
I don't want to see accessibility markers, which kick in as soon as html[data-whatintent="keyboard"]

@ten1seven
Copy link
Owner

Thanks for this suggestion @warkentien2!

I gave this a bit of thought and was considering going one further and creating an API function that would allow you to provide a parent container and list of focusable children. It could be used internally for forms but then available for things like your use case. Something like:

whatInput.contain('my-parent-selector', ['button', 'input', 'select', 'textarea', '.some-custom-control'])

Thoughts about that working for your use case but also being generic enough to be useful for others?

@warkentien2
Copy link
Author

Providing a parent container will work perfectly.

Thank you!

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

No branches or pull requests

2 participants