Skip to content

Commit

Permalink
Tweak mobile layout to ensure placeholder text is visible
Browse files Browse the repository at this point in the history
Thanks to Terry for the inspiration - at the smallest breakpoint we swap the label and placeholder text, to ensure the full instructions are visible!
  • Loading branch information
timcowlishaw committed Jan 31, 2023
1 parent 36a5948 commit 6af0d6b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 23 additions & 1 deletion ds_judgements_public_ui/sass/includes/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,18 @@
padding-right: calc($spacer__unit * 3);
}

&__search-term-label {
&__search-term-label.desktop {
@media (max-width: $grid__breakpoint-medium) {
display: none;
}
@include sr-only;

}

&__search-term-label.mobile {
@media (min-width: $grid__breakpoint-medium) {
display: none;
}
}

&__search-term-input {
Expand All @@ -75,6 +85,18 @@
@media (min-width: $grid__breakpoint-extra-large) {
width: 35rem;
}

&.mobile {
@media (min-width: $grid__breakpoint-medium) {
display: none;
}
}

&.desktop {
@media (max-width: $grid__breakpoint-medium) {
display: none;
}
}
}

input[type=checkbox] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<h2 class="search-component__header--sr-only">{% translate "basicsearchform.title" %}</h2>
<form action="{% url 'results' %}" role="search" aria-label="Search by keyword or neutral citation" id="analytics-basic-search">

<label for="search_term" class="search-component__search-term-label">{% translate "basicsearchform.label" %}</label>
<input class="search-component__search-term-input" id="search_term" name="query" type="text" value="" placeholder="{% translate "basicsearchform.placeholder" %}">
<label for="search_term" class="search-component__search-term-label desktop">{% translate "basicsearchform.label" %}</label>
<input class="search-component__search-term-input desktop" id="search_term" name="query" type="text" value="" placeholder="{% translate "basicsearchform.placeholder" %}">
<label for="search_term" class="search-component__search-term-label mobile">{% translate "basicsearchform.placeholder" %}</label>
<input class="search-component__search-term-input mobile" id="search_term" name="query" type="text" value="" placeholder="{% translate "basicsearchform.label" %}">
{{ form.search_term }}
<input type="submit" value="{% translate "basicsearchform.cta" %}">

Expand Down
2 changes: 1 addition & 1 deletion locale/en_GB/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ msgstr "Search"

#: ds_judgements_public_ui/templates/includes/basic_search_form.html:8
msgid "basicsearchform.placeholder"
msgstr "Enter keyword, party name or neutral citation"
msgstr "Enter keyword, party name or neutral&nbsp;citation"

#: ds_judgements_public_ui/templates/includes/basic_search_form.html:10
msgid "basicsearchform.cta"
Expand Down

0 comments on commit 6af0d6b

Please sign in to comment.