Commit graph

86 commits

Author SHA1 Message Date
Niklas Baumgardner
0fa91d7bb3 Bug 1896002 - Enable screenshots preview buttons if download fails. r=sfoster,kcochrane
Differential Revision: https://phabricator.services.mozilla.com/D209979
2024-05-15 13:44:24 +00:00
Niklas Baumgardner
49219fbed3 Bug 1801957 - Create region with keyboard for screenshots. r=sfoster,firefox-desktop-core-reviewers ,accessibility-frontend-reviewers,Gijs,morgan
The problem I'm trying to solve: There is currently no way to create a selected region in the screenshots overlay with the keyboard.
I recently added support for resizing a selected region in bug 1801954, but a user still needs to create a region with the mouse before the keyboard can be used.

I tried to look at what other browsers are doing in this scenario. Unfortunately there isn't much to go off. Most browsers, I can't even take a screenshot and the only browser that I found to have keyboard support for screenshots is MS Edge. In Edge, when you open screenshots, if your mouse isn't over the content area it will immediately move your mouse to the center of the page. If your mouse is over the content, it remains in place. Then, arrow keys will move the cursor around and you can hit space/enter to start creating a region.

I didn't like that Edge moved the mouse immediately after opening screenshots so I took a different approach.

My approach:
Screenshots will not move the mouse until an arrow key is pressed.
How it works:
If your cursor is above the content and an arrow key is pressed, the cursor will move in the direction of the arrow key that was pressed.
If your cursor is not above the content and a arrow key is pressed, the cursor will be moved to the middle of the content. Screenshots will not move the cursor until an arrow key is pressed.

When moving around the overlay with the keyboard: only hitting an arrow key will move the cursor around by 1px. If shift + arrow key, the cursor will move around by 10px.
When space is clicked while moving the cursor, it will start a region. Moving the arrow keys allows the region to sized.
When the cursor is above an element and the hover element rect is visible, hitting enter will select that region. If no hover element region exists, enter will behave the same as space.

I am also keeping the screenshots UI focused in this patch. Tab/shift + tab will keep focus to screenshots UI. Shift + F6 will escape the focus loop I've made in this patch if needed. Although, if a user has entered screenshots, it makes sense that for the current time, only screenshots UI is focusable.

Differential Revision: https://phabricator.services.mozilla.com/D197703
2024-05-03 22:05:52 +00:00
Niklas Baumgardner
4de00c46ab Bug 1894740 = Wait for image load before trying to save or copy. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D209295
2024-05-03 14:29:40 +00:00
Cristian Tuns
f388d3e51f Backed out changeset 91e7087aef18 (bug 1801957) for causing bc failures in browser_keyboard_tests.js CLOSED TREE 2024-05-02 12:14:10 -04:00
Niklas Baumgardner
83b479b588 Bug 1801957 - Create region with keyboard for screenshots. r=sfoster,firefox-desktop-core-reviewers ,accessibility-frontend-reviewers,Gijs,morgan
The problem I'm trying to solve: There is currently no way to create a selected region in the screenshots overlay with the keyboard.
I recently added support for resizing a selected region in bug 1801954, but a user still needs to create a region with the mouse before the keyboard can be used.

I tried to look at what other browsers are doing in this scenario. Unfortunately there isn't much to go off. Most browsers, I can't even take a screenshot and the only browser that I found to have keyboard support for screenshots is MS Edge. In Edge, when you open screenshots, if your mouse isn't over the content area it will immediately move your mouse to the center of the page. If your mouse is over the content, it remains in place. Then, arrow keys will move the cursor around and you can hit space/enter to start creating a region.

I didn't like that Edge moved the mouse immediately after opening screenshots so I took a different approach.

My approach:
Screenshots will not move the mouse until an arrow key is pressed.
How it works:
If your cursor is above the content and an arrow key is pressed, the cursor will move in the direction of the arrow key that was pressed.
If your cursor is not above the content and a arrow key is pressed, the cursor will be moved to the middle of the content. Screenshots will not move the cursor until an arrow key is pressed.

When moving around the overlay with the keyboard: only hitting an arrow key will move the cursor around by 1px. If shift + arrow key, the cursor will move around by 10px.
When space is clicked while moving the cursor, it will start a region. Moving the arrow keys allows the region to sized.
When the cursor is above an element and the hover element rect is visible, hitting enter will select that region. If no hover element region exists, enter will behave the same as space.

I am also keeping the screenshots UI focused in this patch. Tab/shift + tab will keep focus to screenshots UI. Shift + F6 will escape the focus loop I've made in this patch if needed. Although, if a user has entered screenshots, it makes sense that for the current time, only screenshots UI is focusable.

Differential Revision: https://phabricator.services.mozilla.com/D197703
2024-05-02 15:34:39 +00:00
Niklas Baumgardner
b3205338ac Bug 1892125 - Refactor screenshots preview. r=sfoster,fluent-reviewers,desktop-theme-reviewers,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D207884
2024-04-30 23:55:55 +00:00
Sam Foster
83d5383b9b Bug 1818862 - Revise how we generate a filename to fit inside platform pathname length constraints. r=niklas
Differential Revision: https://phabricator.services.mozilla.com/D171632
2024-04-18 23:44:17 +00:00
Iulian Moraru
ca23572bdd Backed out changeset a188fd9e5365 (bug 1818862) for causing bc failures on browser_screenshots_download_filenames.js. CLOSED TREE 2024-04-18 06:40:48 +03:00
Sam Foster
465b642e9e Bug 1818862 - Revise how we generate a filename to fit inside platform pathname length constraints. r=niklas
Differential Revision: https://phabricator.services.mozilla.com/D171632
2024-04-17 23:37:19 +00:00
Niklas Baumgardner
9639f49368 Bug 1864038 - Add keyboard shortcuts for screenshots overlay. r=sfoster,fluent-reviewers,bolsson,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D193847
2024-04-03 23:51:56 +00:00
Cristian Tuns
74d7116454 Backed out changeset d41d18cecc78 (bug 1864038) for causing bc failures in browser_screenshots_drag_scroll_test.js CLOSED TREE 2024-04-02 12:41:01 -04:00
Niklas Baumgardner
ad214075f8 Bug 1864038 - Add keyboard shortcuts for screenshots overlay. r=sfoster,fluent-reviewers,bolsson,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D193847
2024-04-02 15:53:57 +00:00
Norisz Fay
d358fd5803 Backed out changeset 13111643fbf4 (bug 1864038) for causing bc failures on browser_screenshots_drag_scroll_test.js CLOSED TREE 2024-04-02 05:04:20 +03:00
Niklas Baumgardner
f92101ac64 Bug 1864038 - Add keyboard shortcuts for screenshots overlay. r=sfoster,fluent-reviewers,bolsson,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D193847
2024-04-01 22:33:12 +00:00
Narcis Beleuzu
4519bb1532 Backed out changeset 4bcd94d558a6 (bug 1864038) for bc failure on browser_screenshots_drag_scroll_test.js 2024-04-01 17:29:08 +03:00
Niklas Baumgardner
a335bce89a Bug 1864038 - Add keyboard shortcuts for screenshots overlay. r=sfoster,fluent-reviewers,bolsson,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D193847
2024-04-01 13:51:16 +00:00
Niklas Baumgardner
b8bd15f8f6 Bug 1884936 - Make sure there are no gaps in screenshots canvas. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D204367
2024-03-12 19:34:25 +00:00
Niklas Baumgardner
057d0352c9 Bug 1884172 - Use x-moz-nativeimage when copying screenshots to clipboard. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D204256
2024-03-12 19:03:33 +00:00
Stanca Serban
f36bbbde0b Backed out changeset 1e8ffb360c27 (bug 1884172) for causing OSX mochitests failures in browser_screenshots_test_visible.js. CLOSED TREE 2024-03-12 19:10:04 +02:00
Niklas Baumgardner
456e038920 Bug 1884172 - Use x-moz-nativeimage when copying screenshots to clipboard. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D204256
2024-03-12 14:22:34 +00:00
Sandor Molnar
7154a82293 Backed out changeset a24a00e9a529 (bug 1884172) for causing bc failures @ browser/components/screenshots/tests/browser/browser_screenshots_test_full_page.js CLOSED TREE 2024-03-12 01:03:08 +02:00
Niklas Baumgardner
6019a24b85 Bug 1884172 - Use x-moz-nativeimage when copying screenshots to clipboard. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D204256
2024-03-11 16:18:31 +00:00
Niklas Baumgardner
516cbdd03d Bug 1882925 - Floor coordinates before drawing to canvas in screenshots. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D203769
2024-03-07 22:55:58 +00:00
Niklas Baumgardner
3e4d27dae4 Bug 1873947 - Fix dragging screenshots tab to new window. r=sfoster,mconley
Differential Revision: https://phabricator.services.mozilla.com/D198470
2024-03-07 13:32:00 +00:00
Sam Foster
b496d884f0 Bug 1789727 - Default to the component implementation of Screenshots for nightly builds. r=extension-reviewers,sfoster,robwu,chutten
* Flip the component pref to true by default for nightly builds only
* Move the pref check and initialization to a startup idle task
* And be a bit smarter about when we get and disable the addon
* Fix a bug where we try to communicate with the overlay after the window actor is destroyed when
  the component pref gets flipped off during use

Differential Revision: https://phabricator.services.mozilla.com/D196888
2024-03-04 21:13:17 +00:00
Sandor Molnar
ef39b591b9 Backed out changeset 5b88e57227bc (bug 1789727) for causing bc failures @ browser_feature_callout_in_chrome.js & browser_asrouter_toolbarbadge CLOSED TREE 2024-03-01 20:33:14 +02:00
Sam Foster
9911ad6052 Bug 1789727 - Default to the component implementation of Screenshots for nightly builds. r=extension-reviewers,sfoster,robwu,chutten
* Flip the component pref to true by default for nightly builds only
* Move the pref check and initialization to a startup idle task
* And be a bit smarter about when we get and disable the addon
* Fix a bug where we try to communicate with the overlay after the window actor is destroyed when
  the component pref gets flipped off during use

Differential Revision: https://phabricator.services.mozilla.com/D196888
2024-03-01 15:02:51 +00:00
Noemi Erli
02ac792b19 Backed out changeset 9b4da905ce36 (bug 1789727) for causing failures in browser_asrouter_toolbarbadge.js CLOSED TREE 2024-02-29 22:43:51 +02:00
Sam Foster
24d2e39f9d Bug 1789727 - Default to the component implementation of Screenshots for nightly builds. r=extension-reviewers,sfoster,robwu,chutten
* Flip the component pref to true by default for nightly builds only
* Move the pref check and initialization to a startup idle task
* And be a bit smarter about when we get and disable the addon
* Fix a bug where we try to communicate with the overlay after the window actor is destroyed when
  the component pref gets flipped off during use

Differential Revision: https://phabricator.services.mozilla.com/D196888
2024-02-29 18:27:46 +00:00
Sandor Molnar
801590e08e Backed out changeset c8f7d19d58bb (bug 1789727) for causing telemetry/marionette/tests/client/test_subsession_management.py CLOSED TREE 2024-02-28 18:42:48 +02:00
Sam Foster
92b8f5b6e3 Bug 1789727 - Default to the component implementation of Screenshots for nightly builds. r=extension-reviewers,sfoster,robwu
* Flip the component pref to true by default for nightly builds only
* Move the pref check and initialization to a startup idle task
* And be a bit smarter about when we get and disable the addon
* Fix a bug where we try to communicate with the overlay after the window actor is destroyed when
  the component pref gets flipped off during use

Differential Revision: https://phabricator.services.mozilla.com/D196888
2024-02-28 15:40:08 +00:00
Sam Foster
926e099524 Bug 1874154 - Anchor the 'Screenshot copied' notification on the hamburger menu button if the screenshot button isn't available. r=niklas
Differential Revision: https://phabricator.services.mozilla.com/D201143
2024-02-14 20:12:30 +00:00
Niklas Baumgardner
0aaf858381 Bug 1791086 - Select elements within iframes in screenshots. r=sfoster,mconley
Differential Revision: https://phabricator.services.mozilla.com/D195165
2024-02-09 22:02:51 +00:00
Niklas Baumgardner
c5c36d0430 Bug 1876779 - Fix issue with last screenshot method. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D199747
2024-01-30 20:05:53 +00:00
Niklas Baumgardner
be75dc6b05 Bug 1875034 - Round screenshots region before drawSnapshot. r=sfoster
Both the extension and the component were both passing in numbers like 286.6499938964844 but they were behind rounded differently or something?
It seems to me that the extension was flooring the numbers somewhere and the component wasn't flooring or rounding the numbers anywhere.
The two images would start off being the same but then would progressively become more different. See image diff below
{F5955989}

If we round the region before drawing the snapshot the resulting images will match.
Sometimes there is some offset difference (only 1 px difference) because the component now `round`s and I think the extensions `floor`s. `286.6499938964844` would be `286` for the extension and `287` for the component.

Differential Revision: https://phabricator.services.mozilla.com/D199059
2024-01-25 15:27:08 +00:00
Niklas Baumgardner
aca7845a56 Bug 1867644 - Focus last used button for screenshots UI. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D197348
2024-01-19 22:08:30 +00:00
Stanca Serban
a56fab1284 Backed out changeset 9df2731a0530 (bug 1867644) for causing mochitests failures in browser_contentAltClick.js on OSX. CLOSED TREE 2024-01-20 03:59:49 +02:00
Niklas Baumgardner
c922147937 Bug 1867644 - Focus last used button for screenshots UI. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D197348
2024-01-19 22:08:30 +00:00
Natalia Csoregi
5fd68dd6cb Backed out changeset c6a30d94edf2 (bug 1867644) for causing failures on browser_screenshots_drag_test.js. CLOSED TREE 2024-01-19 03:46:03 +02:00
Niklas Baumgardner
0c9ea25838 Bug 1867644 - Focus last used button for screenshots UI. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D197348
2024-01-19 00:07:46 +00:00
Iulian Moraru
c2befb5de7 Backed out changeset 2b70f662a797 (bug 1867644) for causing bc failures on browser_overlay_keyboard_test.js. CLOSED TREE 2024-01-18 22:14:11 +02:00
Niklas Baumgardner
fbd83453f3 Bug 1867644 - Focus last used button for screenshots UI. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D197348
2024-01-18 17:47:54 +00:00
Niklas Baumgardner
3126ddf62c Bug 1874014 - Check that screenshots anchor is connected to document. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D198199
2024-01-11 18:51:57 +00:00
Sam Foster
f3819a9d6c Bug 1820015 - Make the screenshots UI keyboard accessible. r=niklas
* Move the chrome panel buttons into a `box` which is inserted into #navigator-toolbox
* Adjust what open/closed means using hidden instead
* Capture a weak ref to the focused element on open, and attempt to put focus back on exit
* Add some restore-focus tests
* Fix a bug where cancel via overlay "X" button wasn't exiting properly
* Place initial focus in the preview dialog button on the download button

Differential Revision: https://phabricator.services.mozilla.com/D181184
2023-12-18 19:01:44 +00:00
Niklas Baumgardner
31d21cfa94 Bug 1842037 - Update screenshots telemetry. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D191679
2023-11-14 15:57:46 +00:00
Norisz Fay
ba48d1612a Backed out changeset 9ec09eb75c9f (bug 1842037) for causing bc failures on browser_screenshots_drag_test.js CLOSED TREE 2023-11-14 04:06:58 +02:00
Niklas Baumgardner
cf3a00db17 Bug 1842037 - Update screenshots telemetry. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D191679
2023-11-13 23:57:17 +00:00
Niklas Baumgardner
6e5b9a5a1e Bug 1854953 - Improve performance when taking large screenshots. r=sfoster,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D189158
2023-10-12 16:15:41 +00:00
Cristina Horotan
bb4c800611 Backed out changeset 919bb91f27bb (bug 1854953) for causing bc failures on browser_screenshots_drag_test.js CLOSED TREE 2023-10-11 00:38:25 +03:00
Niklas Baumgardner
3d5c54e8d0 Bug 1854953 - Improve performance when taking large screenshots. r=sfoster,desktop-theme-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D189158
2023-10-10 16:39:02 +00:00