Skip to content

Commit f0424a9

Browse files
committed
Bug 1902683 - Early return on keydown when screenshots button is focused. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D213811 UltraBlame original commit: 805b6d6eda9f1b74056e5eb23f3057a122d7b32d
1 parent 6870727 commit f0424a9

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

browser/components/screenshots/ScreenshotsOverlayChild.sys.mjs

+27
Original file line numberDiff line numberDiff line change
@@ -3835,6 +3835,19 @@ if
38353835
(
38363836
this
38373837
.
3838+
handleKeyDownOnButton
3839+
(
3840+
event
3841+
)
3842+
)
3843+
{
3844+
return
3845+
;
3846+
}
3847+
if
3848+
(
3849+
this
3850+
.
38383851
hoverElementRegion
38393852
.
38403853
isRegionValid
@@ -3872,13 +3885,19 @@ case
38723885
"
38733886
:
38743887
{
3888+
if
3889+
(
38753890
this
38763891
.
38773892
handleKeyDownOnButton
38783893
(
38793894
event
38803895
)
3896+
)
3897+
{
3898+
return
38813899
;
3900+
}
38823901
if
38833902
(
38843903
Services
@@ -7165,7 +7184,15 @@ downloadSelectedRegion
71657184
;
71667185
break
71677186
;
7187+
default
7188+
:
7189+
return
7190+
false
7191+
;
71687192
}
7193+
return
7194+
true
7195+
;
71697196
}
71707197
/
71717198
*

browser/components/screenshots/tests/browser/browser_keyboard_tests.js

+7
Original file line numberDiff line numberDiff line change
@@ -2752,6 +2752,13 @@ waitForOverlay
27522752
)
27532753
;
27542754
await
2755+
helper
2756+
.
2757+
hoverTestPageElement
2758+
(
2759+
)
2760+
;
2761+
await
27552762
SpecialPowers
27562763
.
27572764
spawn

browser/components/screenshots/tests/browser/head.js

+97
Original file line numberDiff line numberDiff line change
@@ -3712,6 +3712,103 @@ textContent
37123712
;
37133713
}
37143714
async
3715+
hoverTestPageElement
3716+
(
3717+
elementId
3718+
=
3719+
"
3720+
testPageElement
3721+
"
3722+
)
3723+
{
3724+
let
3725+
rect
3726+
=
3727+
await
3728+
this
3729+
.
3730+
getTestPageElementRect
3731+
(
3732+
elementId
3733+
)
3734+
;
3735+
let
3736+
dims
3737+
=
3738+
await
3739+
this
3740+
.
3741+
getContentDimensions
3742+
(
3743+
)
3744+
;
3745+
let
3746+
x
3747+
=
3748+
Math
3749+
.
3750+
floor
3751+
(
3752+
rect
3753+
.
3754+
x
3755+
+
3756+
dims
3757+
.
3758+
scrollX
3759+
+
3760+
rect
3761+
.
3762+
width
3763+
/
3764+
2
3765+
)
3766+
;
3767+
let
3768+
y
3769+
=
3770+
Math
3771+
.
3772+
floor
3773+
(
3774+
rect
3775+
.
3776+
y
3777+
+
3778+
dims
3779+
.
3780+
scrollY
3781+
+
3782+
rect
3783+
.
3784+
height
3785+
/
3786+
2
3787+
)
3788+
;
3789+
mouse
3790+
.
3791+
move
3792+
(
3793+
x
3794+
y
3795+
)
3796+
;
3797+
await
3798+
this
3799+
.
3800+
waitForHoverElementRect
3801+
(
3802+
rect
3803+
.
3804+
width
3805+
rect
3806+
.
3807+
height
3808+
)
3809+
;
3810+
}
3811+
async
37153812
clickTestPageElement
37163813
(
37173814
elementId

0 commit comments

Comments
 (0)