open-ui icon indicating copy to clipboard operation
open-ui copied to clipboard

[Invokers] no magic defaults please

Open tomByrer opened this issue 2 years ago • 5 comments
trafficstars

<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!

tomByrer avatar Oct 03 '23 04:10 tomByrer

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;
}

keithamus avatar Oct 03 '23 09:10 keithamus

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.

tomByrer avatar Oct 04 '23 04:10 tomByrer

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 avatar Oct 04 '23 10:10 keithamus

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.

lukewarlow avatar Oct 06 '23 19:10 lukewarlow

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

lukewarlow avatar Nov 12 '23 19:11 lukewarlow

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[bot] avatar May 11 '24 00:05 github-actions[bot]