-
Notifications
You must be signed in to change notification settings - Fork 46.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Do not set selection when prior selection is undefined (#12062) `restoreSelection` did not account for input elements that have changed type after the commit phase. The new `text` input supported selection but the old `email` did not and `setSelection` was incorrectly trying to restore `null` selection state. We also extend input type check in selection capabilities to cover cases where input type is `search`, `tel`, `url`, or `password`. * Add link to HTML spec for element types and selection * Add reset button to ReplaceEmailInput This commit adds a button to restore the original state of the ReplaceEmailInput fixture so that it can be run multiple times without refreshing the page.
- Loading branch information
1 parent
79a740c
commit e0a03c1
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
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,40 @@ | ||
import Fixture from '../../Fixture'; | ||
|
||
const React = window.React; | ||
|
||
class ReplaceEmailInput extends React.Component { | ||
state = { | ||
formSubmitted: false, | ||
}; | ||
|
||
onReset = () => { | ||
this.setState({formSubmitted: false}); | ||
}; | ||
|
||
onSubmit = event => { | ||
event.preventDefault(); | ||
this.setState({formSubmitted: true}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fixture> | ||
<form className="control-box" onSubmit={this.onSubmit}> | ||
<fieldset> | ||
<legend>Email</legend> | ||
{!this.state.formSubmitted ? ( | ||
<input type="email" /> | ||
) : ( | ||
<input type="text" disabled={true} /> | ||
)} | ||
</fieldset> | ||
</form> | ||
<button type="button" onClick={this.onReset}> | ||
Reset | ||
</button> | ||
</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