Skip to content

Commit

Permalink
Issue #5955: Clear URL query when using reset button on modules and p…
Browse files Browse the repository at this point in the history
…ermissions pages.

By @yorkshire-pudding, @klonos, @argiepiano, and @quicksketch.
  • Loading branch information
yorkshire-pudding authored Sep 13, 2023
1 parent 8fe9313 commit 3ff93ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion core/modules/system/js/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ Backdrop.behaviors.moduleFilter = {
}
}

// Clear out the input field when clicking the reset button.
// Clear out the input field and search query when clicking the reset
// button.
function resetModuleList(e) {
// Clear the input field.
$input.val('').triggerHandler('keyup');
e.preventDefault();

// Clear the search query.
var currentUrl = new URL(window.location);
currentUrl.searchParams.delete('search');
window.history.replaceState({}, '', currentUrl);
}

if ($form.length) {
Expand Down
9 changes: 8 additions & 1 deletion core/modules/user/js/user.permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ Backdrop.behaviors.permissionsFilter = {
}
}

// Clear out the input field when clicking the reset button.
// Clear out the input field and search query when clicking the reset
// button.
function resetPermissionsList(e) {
// Clear the input field.
$input.val('').triggerHandler('keyup');
e.preventDefault();

// Clear the search query.
var currentUrl = new URL(window.location);
currentUrl.searchParams.delete('search');
window.history.replaceState({}, '', currentUrl);
}

if ($form.length) {
Expand Down

1 comment on commit 3ff93ba

@backdrop-ci
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.