-
Notifications
You must be signed in to change notification settings - Fork 191
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] Should the delegatesfocus attribute be renamed? #368
Comments
I don't know that I have a better name or semantic here, but I would agree on renaming - I saw this and got confused as to how this was related to delegating focus to a shadow root. |
catching up on details now, and I didn't realize at first this was not regular delegates focus because they do both ...delegate focus. I guess that means something different in both contexts that is unfortunately unclear... I suppose the native one kind of 'proxies' while this one kind of 'redirects' (to use webby terms I think we might have similar understanding of)? |
This was discussed in the telecon today and we resolved as follows:
|
As part of the resolution, folks please feel free to chime in on this issue with a suggestion for an HTML content attribute with the behavior "send focus to my first tab-focusable descendent when I am shown". |
Trying to generate some ideas for bikeshedding an attribute name for "send focus to my first tab-focusable descendent instead of myself"...
|
I think I offered |
Thanks @bkardell, forgot about those. |
'passfocus' seems like a winner to me. |
How about |
|
+1 to Melanie's |
The Open UI Community Group just discussed The full IRC log of that discussion<gregwhitworth> Topic: [Popup] Renaming delegatesfocus attribute<una> Github: https://github.com//issues/368 <gregwhitworth> melanierichards: I'm not sure if we're ready to resolve today <gregwhitworth> melanierichards: last time around we resolved that we need to rename delegatefocus attribute due to the conflict with the shadowRoot property <gregwhitworth> melanierichards: let's review the names and see if anything makes sense <gregwhitworth> melanierichards: would love to get the opinions of folks especially non-native english speakers <gregwhitworth> melanierichards: relays-focus, transfersfocus, routesfocus, passesfocus <gregwhitworth> melanierichards: the call is maybe to up-vote things and next week we can poll <gregwhitworth> una: a lot of these names indicate some transfer but the way that we use it. Is it a passive transfer or a capture <gregwhitworth> una: if it's transferring focus and it's giving it to someone else if it's taking it for itself then it's capturing <gregwhitworth> melanierichards: it would be the former <gregwhitworth> melanierichards: if it was the latter it would be the autofocus attribute <hdv> q+ <gregwhitworth> ack hdv <gregwhitworth> hdv: what happens if there is no focusable child? <gregwhitworth> melanierichards: that's a good question, the focus would just remain on the element itself <gregwhitworth> melanierichards: we could look at dialogue today and see how that error solution is handled <gregwhitworth> una: is it possibly to add any pseudocode into the issue because it will help me understand the verbiage <gregwhitworth> flackr: should it get focus if it doesn't have a child with focus <gregwhitworth> flackr: because the author of the element wouldn't be expected <gregwhitworth> gregwhitworth: this is where you figure out the best fail state <gregwhitworth> hdv: I think moving focus is what gets read out, I would expect it to move even if the child doesn't have a focusable element you would want to be able to have the popup read out rather than the button <gregwhitworth> ACTION: melanierichards to determine the error state if no focusable child exists in a delegatesfocus labeled ancestor <gregwhitworth> q? <gregwhitworth> davatron5000: one silly question - you have a present tense of the verb. Is there precedence there? <gregwhitworth> melanierichards: that's up for flexibility <gregwhitworth> melanierichards: the DOM property is in that state <gregwhitworth> melanierichards: my brain seems to think it makes sense either way <gregwhitworth> melanierichards: there's probably not enough precedent to change it <gregwhitworth> end topic |
I like these over the other suggestions. IMO the ideal "universal" API would be something like I was also thinking about why So I'd keep looking more in the direction of something like |
Focus-within |
|
@diondiondion said:
I want to call out that yours is an interesting idea, and maybe |
Putting this to a voteNow that we have a good collection of options, we'd like to put this attribute to a vote. I've collected a couple options that have multiple people interested. Please use the emoji reaction function on this comment to vote on one of the following options: 👍 = If for some reason you run into issues using the reaction function to vote, or don't have a Github account, please reach out and we'll find a way to make sure your input is counted. e.g., I shared this on Twitter, feel free to express your opinion as a direct response to the tweet. |
As a data point, I came here and saw the options before I knew what the proposed attribute actually will do, and I would not have intuited that behavior from any of these options. The last one, “focuscontent” came the closest for me. The others seem like they’d be better fit for a scenario where you wanted to actually forward focus from one element to another (e.g. when clicking this button, I want to focus a particular text box). It seems this attribute will enable a side effect whenever the popup is shown, which led me to think of somewhat verbose names like “focuscontentonshow”. It also seems this could also be viewed as controlling two behaviors:
I wonder if there’s merit to teasing those apart? The first of those almost seems like it could be a parameter on the show() method, rather than an attribute. But perhaps there are other ways these get shown? Or just reuse autofocus for that? The ideas about extending the “autofocus” attribute with multiple possible values are compelling, it’s a shame that compatibility concerns apparently make that approach unviable. One other idea: “autofocuscontent”? |
I agree with @BrandonLive here. All but I think |
Thanks for the response @melanierichards. Since autofocus can't be changed, how about introducing a new enum attribute |
Throwing in the concept of responders from Apple UIKit (https://developer.apple.com/documentation/uikit/uiresponder) For HTML, I’ve leaned on that concept, often calling a method "focusFirstResponder" when I open a dialog or similar things. If re-using autofocus is not an option, I can imagine a more generic attribute such as
Or in the context of HTML:
The question would be wether there are other use cases other than focussing the first responder? Depending on that, it could be boolean or rather have a set of options. I could imagine |
This whole discussion reminds me of the Microsoft Powershell approved verbs list. |
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. |
Reading back through this issue, it sounds like Can we resolve to rename to |
I'm going to Agenda+ this to discuss at a future meeting. There seem to be a number of options:
I'm beginning to be inclined to vote for the last option. Especially since we want to expand this attribute to other elements, there are issues with doing that, and the popup-specific use cases are nebulous at best. If a So basically, Agenda+ to ask for a resolution removing |
the use case for |
Right, but I guess I'm wondering if that use case actually comes up, and in what context (and how often)? |
The Open UI Community Group just discussed
The full IRC log of that discussion<gregwhitworth> Topic: [Popup] Should the delegatesfocus attribute be renamed?<gregwhitworth> github: https://github.com//issues/368 <JonathanNeal> q+ <JonathanNeal> ack JonathanNeal <gregwhitworth> masonf: so the delegatefocus attribute was in the original explainer <gregwhitworth> masonf: in the current prototype there are 2 attributes to set focus which is autofocus although it's re-interpreted when the element is shown it is focused <gregwhitworth> masonf: the other is delegates focus and can only be placed on the element itself and find the first focusable element in the popup and set focus to it <gregwhitworth> masonf: so it's 2 ways to achieve the same thing <gregwhitworth> masonf: there is discussion to make this a generic feature for delegatesfocus <gregwhitworth> masonf: there are a number of questions about that <gregwhitworth> masonf: what's the usecase? <gregwhitworth> masonf: the first proposal of delegatesfocus not support it <gregwhitworth> masonf: we punt this to another discussion <JonathanNeal> q+ <gregwhitworth> masonf: it may/may not be a generic solution <gregwhitworth> JonathanNeal: I was going to ask if it's apt whether or not if it would reflect back into declarative shadow DOM which has shadowroot delegates focus, would this be similar and apply to both <gregwhitworth> masonf: that's a good question and that is what spawned the bikeshed discussion <gregwhitworth> masonf: that's the declarative solution for a shadowDOM host property that handles focus and it's not the same <gregwhitworth> masonf: although they sound similar <gregwhitworth> masonf: if we were to keep this feature in the first version then we would need to review and rename it <gregwhitworth> ack JonathanNeal <gregwhitworth> q? <scotto_> +1 for punt. autofocus would largely achieve. and delegatefocus is really beneficial in a situation where someone doesn't know what content is goign to load within a popup (or other) <dandclark> +1 to punting. Seems we don't have a strong use case since autofocus can achieve the same thing. And I'm concerned about confusion with the slightly different attachShadow delegatesfocus. <JonathanNeal> +1 to punting, otherwise +1 to it being either a generic that plays well with Declarative ShadowDOM, or is well distinguished from Declarative ShadowDOM. (ref: `<template shadowroot="open" shadowrootdelegatesfocus>`) <gregwhitworth> gregwhitworth: we'll need it for scenarios like when a popup appears such as logins <gregwhitworth> masonf: you can do that today <gregwhitworth> masonf: the scenario that this focuses is on is when you don't actually control the other components <gregwhitworth> scotto_: we have some scenarios at Microsoft that could use this <gregwhitworth> scotto_: but that speaks to your point that this has more uses as a generic attribute <bkardell_> +1 <masonf> Proposed resolution: The first version of the Popup API will not support the `delegatesfocus` attribute. We should open an issue to explore a more general `delegatesfocus` feature for all elements. <una> q+ <gregwhitworth> ack una <una> q+ <masonf> RESOLVED: The first version of the Popup API will not support the `delegatesfocus` attribute. We should open an issue to explore a more general `delegatesfocus` feature for all elements. <gregwhitworth> ACTION: masonf to open an issue for a general solution for delegatesfocus <gregwhitworth> una: I notice in the explainer it still says that popup=popup, is there someone that will update that? <gregwhitworth> masonf: I do plan to do that with all of the resolutions we've made; thanks for the reminder <JonathanNeal> :) teamwork! :) |
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811398 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1032067}
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811398 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1032067}
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811398 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1032067}
…p, a=testonly Automatic update from web-platform-tests Remove delegatesfocus behavior from popup The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811398 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1032067} -- wpt-commits: 3b3bc3508d17e0fbfe335a4fd5c593a3c0a4fdb6 wpt-pr: 35345
The OpenUI resolved [1] to punt this part of the proposal until later, when it might be built in a more general-purpose way. [1] openui/open-ui#368 (comment) Bug: 1307772 Change-Id: I2346791cf8a4e8ba7b2d1d51073d82cc212a4cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811398 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1032067} NOKEYCHECK=True GitOrigin-RevId: 68e42f3582d3b1d63d712b5f1ed080fa0f01f6ff
In PR #355, @mfreed7 mentioned on a discussion regarding the
delegatesfocus
attribute, which tells the user agent to move focus to the popup's first focusable descendent when the popup is shown:Opening this issue to generate discussion on whether
delegatesfocus
is the right name for this attribute.Edit: when this to-be-renamed attribute is applied to
popup
, focus will be automatically sent to the first tab-focusable descendant of the popup, when that popup is shown. So for example:The
<button>
would get focus when this<popup>
is shown. Otherwise, focus would remain wherever it was when the popup was shown; alternatively, a dev could add theautofocus
attribute to<popup>
, and the<popup>
itself would take focus.Note: we are discussing on #367 how this attribute should be extended to other elements on the platform. There's sort of an open question as to whether:
show()
event, aspopup
anddialog
dodelegatesfocus
applied)autofocus
(i.e.delegatesfocus
does not steal focus unless the element to which it's applied also hasautofocus
) <-- IMHO this could be a nice ideaThe text was updated successfully, but these errors were encountered: