playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Docs]: Document the css:light locators

Open jyasskin opened this issue 1 year ago • 3 comments

Page(s)

https://playwright.dev/docs/next/other-locators#css-locator

Description

https://github.com/microsoft/playwright/issues/1375#issuecomment-614032900 mentions that there's a css:light locator engine, but it's not documented in the locators page. There's a mention of the :light suffix in https://playwright.dev/docs/next/other-locators#id-data-testid-data-test-id-data-test-selectors, but that's about non-CSS selectors.

jyasskin avatar Feb 13 '24 17:02 jyasskin

We consider css:light an internal selector engine, hence its not documented properly.

Do you have a specific use-case for what you need it for?

mxschmitt avatar Feb 14 '24 09:02 mxschmitt

I don't have a strong use case: I could handle the cases where the default CSS locators found something in shadow dom by adding precision to exclude those shadow dom elements. It looked from the bugs like css:light was supported, but when I read them again, it was always external folks who brought up the engine, not project members.

The asymmetry of having locators pierce into shadow dom by default but not pierce out (through slots, #29357) is a bit awkward, but I don't yet have evidence that css:light is actually the right level of control to help with that. So I won't object if you close this, and I can reopen it or file a new bug if I find that evidence.

jyasskin avatar Feb 14 '24 21:02 jyasskin

css:light predates modern a11y-based locators and we are slowly walking away from them. We are likely to clean up the docs to remove their mentions altogether. We won't be breaking them, but we'd like to discourage them to the extent of eliminating docs and deprecating in code.

pavelfeldman avatar Feb 15 '24 21:02 pavelfeldman