Skip to content

Commit

Permalink
Only have autofocus on the form on the application search page
Browse files Browse the repository at this point in the history
This is so that users don't end up half way down the page when they first load the landing page which would be very weird
  • Loading branch information
mlandauer committed Jun 20, 2024
1 parent 5ebf888 commit 84412c4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/_tailwind/applications/_address_search.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% content_for :meta_description, Rails.configuration.planningalerts_meta_description %>

<%= render Tailwind::Heading.new(tag: :h1, extra_classes: "sr-only").with_content("Search") %>
<%= render "address_search_form", q:, error: %>
<%= render "address_search_form", q:, error:, autofocus: true %>

<% if error.nil? %>
<div class="grid md:grid-flow-col grid-rows-[repeat(3,_max-content)] auto-cols-fr gap-y-8 gap-x-16 mt-20">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
placeholder: "e.g. 1 Sowerby St, Goulburn, NSW 2580",
class: class_names("text-xl", "text-navy", "w-full", "px-4", "py-3", "sm:py-4", "placeholder-shown:truncate", "focus:ring-4", "focus:ring-sun-yellow", "border-error-red" => error),
required: "required",
autofocus: true,
autofocus:,
"x-data" => "{ async initAutocomplete() {
const { Autocomplete } = await google.maps.importLibrary('places');
new Autocomplete($el, {componentRestrictions: {country: 'au'}, types: ['address']})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% content_for :meta_description, Rails.configuration.planningalerts_meta_description %>

<%= render Tailwind::Heading.new(tag: :h1, extra_classes: "sr-only").with_content("Search") %>
<%= render "address_search_form", q:, error: nil %>
<%= render "address_search_form", q:, error: nil, autofocus: false %>

<%# TODO: Need a proper design for this section %>
<%# TODO: When this section shows up it's not actually clear what the current search is for %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/_tailwind/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% content_for :meta_description, Rails.configuration.planningalerts_meta_description %>

<%= render "banner" %>
<%= render "applications/address_search_form", q: nil, error: nil %>
<%= render "applications/address_search_form", q: nil, error: nil, autofocus: false %>

<div class="divide-y divide-light-grey2">
<%= render "how_it_works" %>
Expand Down

0 comments on commit 84412c4

Please sign in to comment.