Skip to content

fix(focus): add permisison element to focusable elements list #8356

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabrielchl
Copy link

@gabrielchl gabrielchl commented Jun 6, 2025

Closes #8226

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  • change contain={contain} to contain at packages/@react-aria/focus/stories/FocusScope.stories.tsx:61
  • add <permission type="microphone"></permission> to packages/@react-aria/focus/stories/FocusScope.stories.tsx:66
  • in Chrome Beta, visit http://localhost:9003/?path=/story/focusscope--keyboard-navigation-no-contain and verify that the permission element can now be tabbed to and away from

🧢 Your Project:

before (when tab/shift-tab-ing, it skips over the permission element):
Untitled2

after (able to navigate to the permission element via keyboard, and activate the element):
Untitled1

@gabrielchl gabrielchl changed the title fix(focus): add permisison element to focusable elements list fix(focus): add permisison element to focusable elements list. Jun 6, 2025
@gabrielchl gabrielchl changed the title fix(focus): add permisison element to focusable elements list. fix(focus): add permisison element to focusable elements list Jun 6, 2025
Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@reidbarber
Copy link
Member

reidbarber commented Jun 6, 2025

Looks like you'll need to Sign the CLA, then close and re-open this PR to trigger another build that passes.

@gabrielchl gabrielchl closed this Jun 6, 2025
@gabrielchl gabrielchl reopened this Jun 6, 2025
@gabrielchl
Copy link
Author

(could i get the 2nd approval plz? 🥺)

@@ -11,7 +11,8 @@ const focusableElements = [
'embed',
'audio[controls]',
'video[controls]',
'[contenteditable]:not([contenteditable^="false"])'
'[contenteditable]:not([contenteditable^="false"])',
'permission'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can a permission be disabled?

Copy link
Author

@gabrielchl gabrielchl Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't believe so, the spec (https://wicg.github.io/PEPC/permission-element.html) does not mention a way to achieve this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens to the programmatic focus call once this has happened?

Once an element has a permanent blocker, it will be disabled permanently

will the focus call silently fail like it does for other disabled controls? or should users still be able to visit it?

Copy link
Author

@gabrielchl gabrielchl Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah so in the current chrome implementation, the button, when disabled by the browser, will still receive focus like normal
you can test with this in chrome beta:

<button>button 1</button>
<permission type="microphone" style="background: transparent"></permission>
<button>button 2</button>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened Canary and enabled the setting in flags, clicking a permission doesn't do anything right now, so I can't tell if it's "blocked" or not regardless of the style. Am I missing something to get it to actually prompt? https://jsfiddle.net/dyjecvw9/1/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah take away the style to "un-disable" it
i used it to "toggle" between the disabled vs non-disabled behaviour

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah looks like also it doesn't work in jsfiddle lmao
try this: https://codesandbox.io/p/sandbox/permission-focus-example-rnj4pr (once the cloudflare outage is over)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmm my bad it doesn't work there either, you'll have it do it locally :<

Copy link
Member

@snowystinger snowystinger Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, worried that might end up being the case, o well, one of us will try it when we have some time, thanks for the extra info

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.

focusableElements selectors list doesn't include the new <permission /> element
3 participants