Project

General

Profile

Patch #37482 » use-html-autofocus.patch

Go MAEDA, 2022-07-21 16:57

View differences:

app/views/account/login.html.erb
<%= back_url_hidden_field_tag %>
<label for="username"><%=l(:field_login)%></label>
<%= text_field_tag 'username', params[:username], :tabindex => '1' %>
<%= text_field_tag 'username', params[:username], :tabindex => '1', :autofocus => true %>
<label for="password">
<%=l(:field_password)%>
......
<%= call_hook :view_account_login_bottom %>
<% if params[:username].present? %>
<%= javascript_tag "$('#password').focus();" %>
<% else %>
<%= javascript_tag "$('#username').focus();" %>
<% end %>
<%= javascript_tag "$('#password').focus();" if params[:username].present? %>
app/views/sudo_mode/new.html.erb
<div class="box">
<p>
<label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
<%= password_field_tag :sudo_password, nil, size: 25 %>
<%= password_field_tag :sudo_password, nil, size: 25, autofocus: true %>
</br><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
</p>
</div>
<%= submit_tag l(:button_submit) %>
<% end %>
<%= javascript_tag "$('#sudo_password').focus();" %>
(1-1/2)