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

Inheritance with shadow DOM for spellcheck attribute #10050

Open
sanketj opened this issue Jan 11, 2024 · 5 comments
Open

Inheritance with shadow DOM for spellcheck attribute #10050

sanketj opened this issue Jan 11, 2024 · 5 comments
Labels
needs tests Moving the issue forward requires someone to write tests topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@sanketj
Copy link
Member

sanketj commented Jan 11, 2024

The spec for the spellcheck attribute does not explicitly define whether the attribute should inherit across shadow boundaries. Unfortunately, browsers also don't seem to be interoperable in this aspect - Chromium/WebKit do allow the spellcheck attribute to inherit across shadow boundaries while Mozilla does not.

Filing this issue to explore whether interoperability can be achieved and whether a spec update can be made to clarify this behavior.

cc: @mfreed7 @domenic @marcoscaceres @smaug----

@smaug----
Copy link

So Firefox follows the current spec - root element in shadow DOM doesn't have a parent element.

What would be the use case to inherit?

@sanketj
Copy link
Member Author

sanketj commented Jan 11, 2024

This was discussed during a WHATNOT call in the context of #9065. One use case for inheritance is to allow authors to turn off spellcheck for the whole document by setting the attribute to false on the document element. As currently spec'ed, if authors want to also turn off the feature in shadow trees, they would have to explicitly set the spellcheck attribute inside each shadow tree. If inheritance worked across shadow boundaries, they would be able to realize this intent more simply.

@annevk annevk added the topic: shadow Relates to shadow trees (as defined in DOM) label Jan 11, 2024
@sanketj
Copy link
Member Author

sanketj commented Jan 11, 2024

@smaug---- @emilio If we were to update the spec to allow inheritance across shadow boundaries, would Firefox be able to adopt that behavior?

@annevk annevk added the needs tests Moving the issue forward requires someone to write tests label Jan 11, 2024
@annevk
Copy link
Member

annevk commented Jan 11, 2024

Based on https://searchfox.org/wubkat/commit/6e1c9b06a562ecfc8363f93f0eb36d9bcd8f2631 this seems like a 13yo bug.

As @rniwa pointed out to me not inheriting contenteditable across tree boundaries was a deliberate choice. These attributes should follow that. I suggest we add tests for spellcheck and get this fixed.

@sanketj
Copy link
Member Author

sanketj commented Jan 11, 2024

The use cases for some of these attributes (ex. spellcheck, writingsuggestions, translate) inheriting across shadow boundaries seem more compelling than for contenteditable, so I'm not sure if aligning with contenteditable's behavior for all of them is the right choice.

Could you also share more context into why the choice was made to disallow contenteditable from inheriting across shadow boundaries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Moving the issue forward requires someone to write tests topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

3 participants