Add writingsuggestions as a recognized booleanish attribute#36371
Open
jgbiispo wants to merge 1 commit intofacebook:mainfrom
Open
Add writingsuggestions as a recognized booleanish attribute#36371jgbiispo wants to merge 1 commit intofacebook:mainfrom
jgbiispo wants to merge 1 commit intofacebook:mainfrom
Conversation
Add writingsuggestions as a recognized booleanish attribute
`writingsuggestions` is a global HTML attribute that controls whether
the browser offers writing suggestions (autocorrect, autocomplete, etc.).
It is an enumerated attribute accepting "true" and "false", similar to
`draggable` and `spellCheck`.
Previously, passing `writingsuggestions={false}` would silently remove
the attribute from the DOM. Now it correctly sets the attribute to the
string "false".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
writingsuggestionsas a recognized booleanish attributewritingsuggestionsis a global HTML attribute that controls whetherthe browser offers writing suggestions (autocorrect, autocomplete, etc.).
It is an enumerated attribute accepting "true" and "false", similar to
draggableandspellCheck.Previously, passing
writingsuggestions={false}would silently removethe attribute from the DOM. Now it correctly sets the attribute to the
string "false".
Summary
writingsuggestionsis a global HTML attribute introduced in the HTML Living Standard. It accepts"true"(default) or"false"as values, making it a booleanish/enumerated attribute — similar todraggableandspellCheck, not a pure boolean likecredentialless.Before this change:
<div writingsuggestions={false} />would remove the attribute entirely (React's default behavior for unknown attributes receivingfalse)<div WritingSuggestions="false" />would produce no casing suggestionAfter this change:
writingsuggestions={true}renders aswritingsuggestions="true"writingsuggestions={false}renders aswritingsuggestions="false"WritingSuggestionstriggers: "Invalid DOM propertyWritingSuggestions. Did you meanwritingsuggestions?"ReactDOMServer), and hydration.How did you test this change?
Added tests covering:
WritingSuggestionstriggers the correct warning pointing towritingsuggestions{true}→"true",{false}→"false"on the DOM attributerenderToStringand hydrate without mismatch