-
Notifications
You must be signed in to change notification settings - Fork 5
Allow required fields to be highlighted instead of optional fields #78
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
539ad00
Allow devs to highlight required fields instead of highlighting optio…
kbayliss f1d9814
Add tests
kbayliss fd131dd
Fix lock file
kbayliss a6cf34d
Avoid using pytest-django as it breaks things
kbayliss bd3ee41
Update README
kbayliss b05e318
Use new BLOCK block element as it's not always a label
kbayliss 9a337c9
Update changelog
kbayliss eba47e4
Typo
kbayliss 4fa218b
Update README with reference to new classes
kbayliss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
37 changes: 37 additions & 0 deletions
37
tests/layout/__snapshots__/test_checkboxes/test_optional_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_method" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_method_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
How would you like to be contacted? | ||
<span class="tbxforms-field_marker--optional">(optional)</span> | ||
</legend> | ||
<span id="id_method_hint" class="tbxforms-hint">Select all options that are relevant to you.</span> | ||
<div class="tbxforms-checkboxes"> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_1" | ||
value="email" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_1">Email</label> | ||
</div> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_2" | ||
value="phone" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_2">Phone</label> | ||
</div> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_3" | ||
value="text" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_3">Text message</label> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
37 changes: 37 additions & 0 deletions
37
tests/layout/__snapshots__/test_checkboxes/test_required_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_method" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_method_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
How would you like to be contacted? | ||
<span class="tbxforms-field_marker--required" title="(required)">*</span> | ||
</legend> | ||
<span id="id_method_hint" class="tbxforms-hint">Select all options that are relevant to you.</span> | ||
<div class="tbxforms-checkboxes"> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_1" | ||
value="email" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_1">Email</label> | ||
</div> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_2" | ||
value="phone" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_2">Phone</label> | ||
</div> | ||
<div class="tbxforms-checkboxes__item"> | ||
<input type="checkbox" | ||
name="method" | ||
class="tbxforms-checkboxes__input" | ||
id="id_method_3" | ||
value="text" /> | ||
<label class="tbxforms-label tbxforms-checkboxes__label" for="id_method_3">Text message</label> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
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
46 changes: 46 additions & 0 deletions
46
tests/layout/__snapshots__/test_date_input/test_optional_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_date" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_date_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
When was your passport issued? | ||
<span class="tbxforms-field_marker--optional">(optional)</span> | ||
</legend> | ||
<span id="id_date_hint" class="tbxforms-hint">For example, 12 11 2007</span> | ||
<div class="tbxforms-date-input" id="id_date"> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_0">Day</label> | ||
<input type="text" | ||
name="date_0" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-2" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
id="id_date_0"> | ||
</div> | ||
</div> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_1">Month</label> | ||
<input type="text" | ||
name="date_1" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-2" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
id="id_date_1"> | ||
</div> | ||
</div> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_2">Year</label> | ||
<input type="text" | ||
name="date_2" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-4" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
id="id_date_2"> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
49 changes: 49 additions & 0 deletions
49
tests/layout/__snapshots__/test_date_input/test_required_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_date" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_date_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
When was your passport issued? | ||
<span class="tbxforms-field_marker--required" title="(required)">*</span> | ||
</legend> | ||
<span id="id_date_hint" class="tbxforms-hint">For example, 12 11 2007</span> | ||
<div class="tbxforms-date-input" id="id_date"> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_0">Day</label> | ||
<input type="text" | ||
name="date_0" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-2" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
required="required" | ||
id="id_date_0"> | ||
</div> | ||
</div> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_1">Month</label> | ||
<input type="text" | ||
name="date_1" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-2" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
required="required" | ||
id="id_date_1"> | ||
</div> | ||
</div> | ||
<div class="tbxforms-date-input__item"> | ||
<div class="tbxforms-form-group"> | ||
<label class="tbxforms-label tbxforms-date-input__label" for="id_date_2">Year</label> | ||
<input type="text" | ||
name="date_2" | ||
class="tbxforms-input tbxforms-input--text tbxforms-date-input__input tbxforms-input--width-4" | ||
pattern="[0-9]*" | ||
inputmode="numeric" | ||
required="required" | ||
id="id_date_2"> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
14 changes: 14 additions & 0 deletions
14
tests/layout/__snapshots__/test_file_upload/test_optional_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<form class="tbxforms" method="post" enctype="multipart/form-data"> | ||
<div id="div_id_file" class="tbxforms-form-group"> | ||
<label for="id_file" class="tbxforms-label tbxforms-label--m"> | ||
Upload a file | ||
<span class="tbxforms-field_marker--optional">(optional)</span> | ||
</label> | ||
<span id="id_file_hint" class="tbxforms-hint">Select the CSV file to upload.</span> | ||
<input type="file" | ||
name="file" | ||
aria-describedby="id_file_hint" | ||
class="tbxforms-file-upload" | ||
id="id_file"> | ||
</div> | ||
</form> |
15 changes: 15 additions & 0 deletions
15
tests/layout/__snapshots__/test_file_upload/test_required_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<form class="tbxforms" method="post" enctype="multipart/form-data"> | ||
<div id="div_id_file" class="tbxforms-form-group"> | ||
<label for="id_file" class="tbxforms-label tbxforms-label--m"> | ||
Upload a file | ||
<span class="tbxforms-field_marker--required" title="(required)">*</span> | ||
</label> | ||
<span id="id_file_hint" class="tbxforms-hint">Select the CSV file to upload.</span> | ||
<input type="file" | ||
name="file" | ||
aria-describedby="id_file_hint" | ||
class="tbxforms-file-upload" | ||
required="required" | ||
id="id_file"> | ||
</div> | ||
</form> |
37 changes: 37 additions & 0 deletions
37
tests/layout/__snapshots__/test_radios/test_optional_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_method" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_method_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
How would you like to be contacted? | ||
<span class="tbxforms-field_marker--optional">(optional)</span> | ||
</legend> | ||
<span id="id_method_hint" class="tbxforms-hint">Select the most convenient way to contact you.</span> | ||
<div class="tbxforms-radios"> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_1" | ||
value="email" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_1">Email</label> | ||
</div> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_2" | ||
value="phone" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_2">Phone</label> | ||
</div> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_3" | ||
value="text" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_3">Text message</label> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
37 changes: 37 additions & 0 deletions
37
tests/layout/__snapshots__/test_radios/test_required_field_highlighting.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<form class="tbxforms" method="post"> | ||
<div id="div_id_method" class="tbxforms-form-group"> | ||
<fieldset class="tbxforms-fieldset" aria-describedby="id_method_hint"> | ||
<legend class="tbxforms-fieldset__legend tbxforms-fieldset__legend--m"> | ||
How would you like to be contacted? | ||
<span class="tbxforms-field_marker--required" title="(required)">*</span> | ||
</legend> | ||
<span id="id_method_hint" class="tbxforms-hint">Select the most convenient way to contact you.</span> | ||
<div class="tbxforms-radios"> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_1" | ||
value="email" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_1">Email</label> | ||
</div> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_2" | ||
value="phone" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_2">Phone</label> | ||
</div> | ||
<div class="tbxforms-radios__item"> | ||
<input type="radio" | ||
name="method" | ||
class="tbxforms-radios__input" | ||
id="id_method_3" | ||
value="text" /> | ||
<label class="tbxforms-label tbxforms-radios__label" for="id_method_3">Text message</label> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> | ||
</form> |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.