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

[Popup spec] Define in finer detail processing of autofocus and delegatesfocus attrs for popup #330

Closed
melanierichards opened this issue Apr 12, 2021 · 4 comments
Labels
popover The Popover API popover-spec Spec-related issues for the Popover API stale

Comments

@melanierichards
Copy link
Collaborator

On MicrosoftEdge/MSEdgeExplainers#435, @tlouisse asked:

  • Would it also work for shadow dom content?
<popup>
  #shadow-root
  <button autofocus></button>
</popup>
  • What would happen when both host and child apply autofocus (or delegatefocus and autfocus)?
<popup autofocus>
  <button autofocus></button>
</popup>
<popup delegatefocus>
  <button></button>
  <button autofocus></button>
</popup>
  • And what when content is being rendered asynchronously, right after show (since this does not work on first meaningful paint for current autofocus when rendered with a template engine like lit-html)?

Finer details on processing these attributes should be written up in spec text, or should reference existing details in the HTML spec.

@melanierichards melanierichards added the popover The Popover API label Apr 12, 2021
@melanierichards
Copy link
Collaborator Author

melanierichards commented Apr 12, 2021

<popup>
  #shadow-root
  <button autofocus></button>
</popup>

I believe this should work but paging @mfreed7 in case anything has come up in popup prototyping.

<popup autofocus>
  <button autofocus></button>
</popup>

Per the spec details on autofocus this should be invalid use of the attribute. From my reading on dialog I believe the spec indicates that the button would take precedence, but it seems Chromium will focus the dialog first.

<popup delegatefocus>
  <button></button>
  <button autofocus></button>
</popup>

IMHO autofocus should take precedence as it is a more specific indication of author intent, but we should discuss this point.

And what when content is being rendered asynchronously, right after show (since this does not work on first meaningful paint for current autofocus when rendered with a template engine like lit-html)?

dialog runs focusing steps when the dialog is shown; we should follow similar behavior for popup. I'd say it would be better to pre-populate contents or if they must hydrated after show, manage focus explicitly in script.

@tlouisse
Copy link

Thanks @melanierichards

@github-actions
Copy link

There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label.

@github-actions github-actions bot added the stale label Mar 19, 2022
@mfreed7 mfreed7 changed the title [Popup] Define in finer detail processing of autofocus and delegatesfocus attrs for popup [Popup spec] Define in finer detail processing of autofocus and delegatesfocus attrs for popup May 13, 2022
@mfreed7 mfreed7 added the popover-spec Spec-related issues for the Popover API label May 13, 2022
@josepharhar
Copy link
Collaborator

My HTML spec PR uses get focus delegate for popover initial focus, which was thoroughly designed by domenic and handles the autofocus attribute as well as shadowroots with delegatesfocus. This issue can be closed

@mfreed7 mfreed7 closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
popover The Popover API popover-spec Spec-related issues for the Popover API stale
Projects
None yet
Development

No branches or pull requests

4 participants