-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use tidy-html5 to validate the home page #15580
Conversation
Errors corrected: - Attribute "placeholder" not allowed on element "select" at this point. At line 86, column 189 - Attribute "autocorrect" not allowed on element "select" at this point. At line 86, column 189 - Attribute "autocomplete" not allowed on element "select" at this point. At line 86, column 189
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@octopusinvitro this is changing the behaviour of a visible part of the site, so I think this one does need a screenshot to show that it's still working the same way after the change.
@tmtmtmtm I added a screenshot. |
Maybe I'm missing something, but what's the point of including a screenshot in a PR, if the screenshot was taken before the changes in the PR were even written? |
@zarino Because nothing has changed and I am too lazy to take another identical screenshot! 😄 |
I would like to be convinced that we need to do this: My understanding of this is that we're using JS to add these attributes after validation because the validator will otherwise report them. If so, it feels odd to be introducing a JS dependency to get around a problem with the validator. |
We’re adding them because, to the letter of the law, the HTML5 spec[1] doesn't allow If you ask me – it's a classic example of when you can safely ignore the spec. But that's just me. [1] https://www.w3.org/TR/html5/forms.html#the-select-element |
@davewhiteland The easy fix for that would be to include an actual DOM element in the document just before the select with the placeholder/informative, text, and if JS is enabled, it would hide that element, pick the informative text it contains, and use it as a placeholder in the select. @zarino what do you think? |
Including the placeholder text in a Question is: what’s the best way of marking up such a “hint” element. A second label is one option: <p>
<label for="country-selector">Find representatives from your country:</label>
<label for="country-selector">Search by country name</label>
</p>
<%= erb :country_selector %> A separate element inside the same label is another option: <p>
<label for="country-selector">
Find representatives from your country:
<span class="js-turn-me-into-a-placeholder">Search by country name</span>
</label>
</p>
<%= erb :country_selector %> |
@zarino I like the second one better 😃 I would add a third one: <p class="fancy-paragraph">Find representatives from your country:</p>
<p class="js-turn-me-into-a-placeholder">
<label for="country-selector">Search by country name</label>
</p>
<%= erb :country_selector %> |
I'd say that's fine, as long as you can still click the "Find representatives in your country" and it focusses the search box. (That’s something you get for free when you use a |
@zarino ah yes you are right. I'll go with your second option 👍 |
I think I'm going to put a bit of kibosh on this one, at least for now. I can certainly see some value in having all our HTML be completely valid, but this is already several levels removed from the original trigger for this, which was about detecting mismatched tags. The value of the changes being discussed here now seem a little too minimal for the amount of effort, when we have so many other important things to do. |
What does this do?
HTML-validates the home page
Why was this needed?
HTML was broken
Relevant Issue(s)
everypolitician/everypolitician#505
Closes #15562
Implementation notes
The attributes removed to make the validation pass where added back with JavaScript.
Screenshots
(Image by @zarino )
Notes to Reviewer
Errors corrected:
Notes to Merger
None