Prevent ID conflict in ParameterIncludeEmpty#10891
Open
masflam wants to merge 2 commits into
Open
Conversation
9894585 to
5b043b1
Compare
5b043b1 to
af99dd5
Compare
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.
Description
Remove
idandhtmlForattributes from the checkbox and label accordingly, inside ofParameterIncludeEmpty.Motivation and Context
Fixes #10890.
The
ParameterIncludeEmptycomponent is used when editing anapplication/x-www-form-urlencodedrequest body whose schema defines an optional property. It's a labelled checkbox that controls whether the body being edited is to contain a given property at all. When multiple properties are optional, multiple of these checkboxes and labels are rendered. The problem is that each one got the same hard-coded HTML element ID, and each label wasfor=that same ID, resulting in all the labels controlling the same checkbox. (the first one in the DOM in my browser)Since a label by default controls any input nested inside it, these
idandforattributed were completely superfluous. Without them clicking on each label works as expected, toggling the appropriate checkbox only.How Has This Been Tested?
Ran
npm run testto see nothing else broke andnpm run devto see that the changes resolved the issue.Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests