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

[Invokers] no magic defaults please #906

Closed
tomByrer opened this issue Oct 3, 2023 · 6 comments
Closed

[Invokers] no magic defaults please #906

tomByrer opened this issue Oct 3, 2023 · 6 comments

Comments

@tomByrer
Copy link

tomByrer commented Oct 3, 2023

<button invoketarget="my-video">Play/Pause</button>

I do not think there should be magic defaults like this. Could be mis-labeled & bad for ARIA, etc.
I'll grab the attention of others in the Video Player field to chime in, but for now I'd like to see:

<button invoketarget="my-video" invokeaction="playpause">Play/Pause</button>

& then one can CSS:

button[invokeaction="playpause"] {
  background-color: gold;
}

Otherwise, great proposal!

@keithamus
Copy link
Collaborator

I disagree and I think the defaults are an ergonomic win. Less so for video, perhaps, but certainly for dialogs and popovers, where 99% of the time folks are going to want the button to do the intuitive thing (toggle the visibility of the UI).

Could be mis-labeled & bad for ARIA, etc.

Could you please expand on what you see is the problem here? The intent behind the proposal is to allow the browser to handle more of the ARIA stuff on your behalf.

CSS

You can still have the "magic default" with slightly more CSS:

button:is(:not([invokeaction], [invokeaction=auto i]),  {
  background-color: gold;
}

@tomByrer
Copy link
Author

tomByrer commented Oct 4, 2023

certainly for dialogs and popovers

Oh I didn't think of those! Kinda makes sense for those, but haven't thought over.

I'm just strictly looking at invokeaction="playpause" for video players (for now). Perhaps I'm getting old, perhaps I'm getting concerned about teaching teens to web program, but lately I prefer & see the benefit for teaching literal over magic defaults.

That CSS is valid, but very hard to teach anyone who isn't expert level CSS, & that is not all devs who touch CSS. Again, literal is easier.

@keithamus
Copy link
Collaborator

I think we're in agreement on the principle, I can see the point of removing auto for <video> elements, which would force you to pick an invokeaction, but I predict that doing so will raise requests for an auto behaviour as most other elements will have one.

I can't say there's a particularly strong downside to having one. Let's solicit more feedback from people.

keithamus referenced this issue in keithamus/invokers-polyfill Oct 4, 2023
@lukewarlow
Copy link
Collaborator

I'm neutral to removing defaults on at least some elements. For one it limits future compatibility issues. But then adding a default in future would potentially have backwards compatability issues so 🤷

I would like to keep a default for at least popover, dialog and details though.

@keithamus keithamus transferred this issue from keithamus/invokers-polyfill Oct 26, 2023
@keithamus keithamus changed the title no magic defaults please [Invokers] no magic defaults please Oct 26, 2023
@lukewarlow
Copy link
Collaborator

Just as an FYI I'm implementing this in Chrome atm and won't be implementing the auto behaviour at this time.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants