mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Use Super on macOS for page scroll/nav
On macOS, we should use the Cmd (Super) modifier key along with the arrow keys to scroll to the beginning/end of the document, or navigate back and forth in the history, rather than the Ctrl or Alt keys.
This commit is contained in:
parent
894c51e8e7
commit
101a8aef26
Notes:
github-actions[bot]
2025-03-18 19:08:06 +00:00
Author: https://github.com/alec3660 Commit: https://github.com/LadybirdBrowser/ladybird/commit/101a8aef264 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3988 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 5 additions and 1 deletions
|
@ -1272,7 +1272,7 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
|||
switch (key) {
|
||||
case UIEvents::KeyCode::Key_Up:
|
||||
case UIEvents::KeyCode::Key_Down:
|
||||
if (modifiers && modifiers != UIEvents::KeyModifier::Mod_Ctrl)
|
||||
if (modifiers && modifiers != UIEvents::KeyModifier::Mod_PlatformCtrl)
|
||||
break;
|
||||
if (modifiers)
|
||||
key == UIEvents::KeyCode::Key_Up ? document->scroll_to_the_beginning_of_the_document() : document->window()->scroll_by(0, INT64_MAX);
|
||||
|
@ -1281,7 +1281,11 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
|||
return EventResult::Handled;
|
||||
case UIEvents::KeyCode::Key_Left:
|
||||
case UIEvents::KeyCode::Key_Right:
|
||||
#if defined(AK_OS_MACOS)
|
||||
if (modifiers && modifiers != UIEvents::KeyModifier::Mod_Super)
|
||||
#else
|
||||
if (modifiers && modifiers != UIEvents::KeyModifier::Mod_Alt)
|
||||
#endif
|
||||
break;
|
||||
if (modifiers)
|
||||
document->page().traverse_the_history_by_delta(key == UIEvents::KeyCode::Key_Left ? -1 : 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue