Skip to content

Commit

Permalink
prevent double-dispatch of uno events bound to function keys
Browse files Browse the repository at this point in the history
this is reproducible with F1 and a breakpoint on

app.map.showHelp('online-help-content');

in browser/src/docdispatcher.ts

and reverts:

commit 7284884
CommitDate: Thu Sep 12 15:01:24 2024 +0530

    Cypress: Remove Pagedown key call in pdf

now that each page down is processed once

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id140878d3a5d19450fe8141977c3324f97541cea
  • Loading branch information
caolanm committed Nov 6, 2024
1 parent 5f3896e commit b2b637e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions browser/src/map/handler/Map.Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ L.Map.Keyboard = L.Handler.extend({
if (this._map.uiManager.isUIBlocked())
return;

// if we press F1/F2 then the keyboard event is handled twice, use that
// the defaultPrevented is set the first time to avoid the double dispatch
if (ev.defaultPrevented)
return;

if (window.KeyboardShortcuts.processEvent(app.UI.language.fromURL, ev)) {
ev.preventDefault();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'PDF View Tests', function(
});

it('PDF page down', { env: { 'pdf-view': true } }, function() {
cy.cGet('#map').type('{pagedown}');
cy.cGet('#map').type('{pagedown}');
cy.cGet('#preview-frame-part-1').should('have.attr', 'style', 'border: 2px solid darkgrey;');
cy.cGet('#map').type('{pageup}');
Expand Down

0 comments on commit b2b637e

Please sign in to comment.