-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend input type check in selection capabilities (#12062)
When an email input was replaced by a disabled text input on the same DOM position, an error would occur when trying to `setSelection`. The reason was that in `getSelectionInformation` the `selectionRange` was set to `null` as `hasSelectionCapabilities` was returning `false` for an `email` input type. `email` and `tel` input types do have selection capabilities, so in that case, `hasSelectionCapabilities` should return `true`.
- Loading branch information
1 parent
885a291
commit aa115f7
Showing
4 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
fixtures/dom/src/components/fixtures/text-inputs/ReplaceEmailInput.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Fixture from '../../Fixture'; | ||
|
||
const React = window.React; | ||
|
||
class ReplaceEmailInput extends React.Component { | ||
state = { | ||
formSubmitted: false, | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fixture> | ||
<form | ||
className="control-box" | ||
onSubmit={event => { | ||
event.preventDefault(); | ||
this.setState({formSubmitted: true}); | ||
}}> | ||
<fieldset> | ||
<legend>Email</legend> | ||
{!this.state.formSubmitted ? ( | ||
<input type="email" /> | ||
) : ( | ||
<input type="text" disabled={true} /> | ||
)} | ||
</fieldset> | ||
</form> | ||
</Fixture> | ||
); | ||
} | ||
} | ||
|
||
export default ReplaceEmailInput; |
This file contains 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
This file contains 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
This file contains 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