Skip to content

Commit

Permalink
Added fix for focus behaviour in pages with a .form-section-preview
Browse files Browse the repository at this point in the history
The current behaviour for the focus state when providing an update to a report is going directly into the first input after the .form-section-preview and its content, making it difficult for users using assistive devices to edit an "update" once they have pressed the "continue" button, because they would need to travel across the whole page in order to reach "Edit your update" button. With this fix the focus state goes directly to the content inside ".form-section-preview" if this element exist.
  • Loading branch information
lucascumsille committed May 7, 2024
1 parent 23a43e2 commit 28c7613
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/cobrands/fixmystreet/fixmystreet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,15 @@ $.extend(fixmystreet.set_up, {

var focusFirstVisibleInput = function() {
// Ignore logged-in form here, because it should all be pre-filled already!
$('#form_sign_in_yes input, #form_sign_in_no input').filter(':visible').eq(0).trigger('focus');
var $inputs = $('#form_sign_in_yes input, #form_sign_in_no input').filter(':visible');

// Check if there is an element with class .form-section-preview. This will allow users to rectify any previews answers without having to circle around the whole page.
var $formSectionPreview = $('.form-section-preview').first();
if ($formSectionPreview.length) {
$formSectionPreview.children().first().trigger('focus');
} else {
$inputs.eq(0).trigger('focus');

Check warning on line 1340 in web/cobrands/fixmystreet/fixmystreet.js

View check run for this annotation

Codecov / codecov/patch

web/cobrands/fixmystreet/fixmystreet.js#L1340

Added line #L1340 was not covered by tests
}
};

// Display tweak
Expand Down

0 comments on commit 28c7613

Please sign in to comment.