-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Don't set the first option as selected in select tag with size
attribute
#14242
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
I added some more clarification for why size must be set on select element creation: - In the source code - In the DOM test fixture - In a unit test
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,10 @@ export function createElement( | |
if (props.multiple) { | ||
node.multiple = true; | ||
} else if (props.size) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested in Chrome and noticed that when a select element is marked as |
||
// Setting a size greater than 1 causes a select to behave like `multiple=true`, where | ||
// it is possible that no option is selected. | ||
// | ||
// This is only necessary when a select in "single selection mode". | ||
node.size = props.size; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small thing, but could you add a comment indicating that assigning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds like, this does essentially the same thing as setting https://codepen.io/nhunzaker/pen/VgRQEy |
||
} | ||
} | ||
|
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.