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

[invokers] Defining more complex invocation actions within CSS

Open MinekPo1 opened this issue 1 year ago • 2 comments

Currently, at least from my understanding, invokers are a 1:1 system, in other words, each input affects one element. Furthermore, currently any non-default invocation actions must be defined via JavaScript.

I believe this limits use cases of invokers, thus falling back to doing everything within JavaScript, or not doing anything, some reasons below:

  • users which disable JavaScript execution for privacy or security reasons will still be excluded from interactivity
  • browsers have a limited ability to optimize invokers, since in many cases this system will hook into JavaScript
  • developers may be less interested in using invokers to their full extent, since many sites still require a but of JavaScript

Some usecases, that I believe this system should be able to support:

  • A set of detail elements where opening one of them closes all other that are opened (ex. the FAQ for LibreTube, disclaimer: I have contributed to this project)
  • A button which needs to be pressed several times before an action is triggered
  • A popup which can be closed only when a checkbox is enabled

I believe that this system should be limited, such that the following behaviour would still require JavaScript:

  • Saving state between page loads
  • Creating requests

One issue this presents is accessibly: I am proposing to add features which browsers likely will not be able to easily describe, however I believe this has low impact on accessibility, as the alternative would be as, or even worse in this regard.

Some things I believe should be discussed before major design decisions are made:

  • How much interactivity should be desired for usage of this potential feature, instead of features given by HTML alone, to be justified?
  • Similarly, how much interactivity should be justified for usage of JavaScript to be justified?
  • Should this feature be created as a invokee, an action or a property of the invokee element?

MinekPo1 avatar Feb 16 '24 13:02 MinekPo1

A set of detail elements where opening one of them closes all other that are opened (ex. the FAQ for LibreTube, disclaimer: I have contributed to this project)

This is solvable with "exclusive accordions", which I believe will be a better fit for the given criteria you describe.

A button which needs to be pressed several times before an action is triggered

How common is this case? I don't think I've seen this kind of thing before. How does such a task get differentiated between, say, double-clicking a button? Does such a technique comply with WCAG SC 2.5.1 or WCAG SC 3.3.7?

A popup which can be closed only when a checkbox is enabled

I think such a form would need to be a <dialog> in which case it could have a <form target=dialog> inside, where the checkbox is required. I think the dialog won't close if the form is invalid. I'm not sure of this case but that's certainly how I would try to implement such a pattern.

keithamus avatar Feb 16 '24 18:02 keithamus

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 Aug 15 '24 00:08 github-actions[bot]