diff --git a/app/assets/javascripts/autofocus.js b/app/assets/javascripts/autofocus.js deleted file mode 100644 index b688a9f20..000000000 --- a/app/assets/javascripts/autofocus.js +++ /dev/null @@ -1,27 +0,0 @@ -(function(Modules) { - "use strict"; - - Modules.Autofocus = function() { - this.start = function(component) { - var $component = $(component), - forceFocus = $component.data('forceFocus'); - - // if the page loads with a scroll position, we can't assume the item to focus onload - // is still where users intend to start - if (($(window).scrollTop() > 0) && !forceFocus) { return; } - - // See if the component itself is something we want to send focus to - var target = $component.filter('input, textarea, select'); - - // Otherwise look inside the component to see if there are any elements - // we want to send focus to - if (target.length === 0) { - target = $('input, textarea, select', $component); - } - - target.eq(0).trigger('focus'); - - }; - }; - -})(window.GOVUK.Modules); diff --git a/app/assets/sass/uswds/_legacy-styles.scss b/app/assets/sass/uswds/_legacy-styles.scss index 2198fb037..208270015 100644 --- a/app/assets/sass/uswds/_legacy-styles.scss +++ b/app/assets/sass/uswds/_legacy-styles.scss @@ -375,3 +375,9 @@ h2.recipient-list { } } } + +.usa-search__input, [type=search] { + border-right: 1px solid; + height: 40px; + margin-top: units(1); +} diff --git a/app/templates/components/live-search.html b/app/templates/components/live-search.html index 58683e957..6e3cfd905 100644 --- a/app/templates/components/live-search.html +++ b/app/templates/components/live-search.html @@ -3,7 +3,7 @@ show=False, form=None, label=None, - autofocus=False + autofocus=True ) %} {%- set search_label = label or form.search.label.text %} @@ -13,11 +13,11 @@ } %} {% if autofocus %} - {% set x=param_extensions.__setitem__("attributes", {"data-module": "autofocus"}) %} + {% set _ = param_extensions.__setitem__("attributes", {"autofocus": "autofocus"}) %} {% endif %} {% if show %} -