mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-02-13 15:01:12 -05:00
Fix slider behavior when using navigate back button (#8496)
Closes https://github.com/FreshRSS/FreshRSS/issues/8488 * Ensure leave confirmation is shown by preventing navigation using the [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API) * Prevent scroll lock by removing it on `hashchange` instead of `onclick` on the close buttons
This commit is contained in:
@@ -1125,8 +1125,8 @@ function init_column_categories() {
|
||||
// Wait for dropdown to be closed so it can be removed
|
||||
// Dropdown visibility is based on CSS :target
|
||||
window.addEventListener('hashchange', () => {
|
||||
dropdownMenu.nextElementSibling.remove(); // dropdown close
|
||||
dropdownMenu.remove();
|
||||
dropdownMenu?.nextElementSibling?.remove(); // dropdown close
|
||||
dropdownMenu?.remove();
|
||||
}, { once: true });
|
||||
}, { once: true });
|
||||
|
||||
@@ -2359,12 +2359,25 @@ function init_main_beforeDOM() {
|
||||
}
|
||||
}
|
||||
|
||||
function init_navigation_handler() {
|
||||
navigation.addEventListener('navigate', (e) => {
|
||||
if (!(e.canIntercept && e.hashChange && e.navigationType === 'traverse')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (location.hash.substr(1) === 'slider' && !close_slider_listener()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function init_main_afterDOM() {
|
||||
removeFirstLoadSpinner();
|
||||
init_notifications();
|
||||
init_csp_alert();
|
||||
init_confirm_action();
|
||||
init_nav_menu();
|
||||
init_navigation_handler();
|
||||
const stream = document.getElementById('stream');
|
||||
if (stream) {
|
||||
init_load_more(stream);
|
||||
|
||||
Reference in New Issue
Block a user