jupyterlab / lumino

Lumino is a library for building interactive web applications
https://lumino.readthedocs.io/
Other
598 stars 127 forks source link

Support the selectors with `:is()` and `:where()` #685

Open krassowski opened 4 months ago

krassowski commented 4 months ago

Problem

Selectors with comma are currently straight out rejected in a few places:

https://github.com/jupyterlab/lumino/blob/10d232e7d45572ed5fbb4389c3c9a4671ab0e5eb/packages/widgets/src/contextmenu.ts#L330-L333

https://github.com/jupyterlab/lumino/blob/10d232e7d45572ed5fbb4389c3c9a4671ab0e5eb/packages/commands/src/index.ts#L1561-L1566

This is understandable because the selector specificity can be only computed for individual selector, not a comma-separated list of selectors.

However, the :is() and :where() selectors now widely supported by browsers and take a comma-separated lists of selectors:

Lack of support for :is and :where makes creating selectors for certain commands and context menu more difficult than it should be in 2024.

Proposed Solution

Implement support for :is() and :where().

Additional context

Encountered this in https://github.com/jupyterlab/jupyterlab/pull/15845 when trying to make the context menu show for .jp-RunningSessions-item:is(.jp-mod-kernel,.jp-mod-kernel-widget).