-
Notifications
You must be signed in to change notification settings - Fork 974
Windows are restored with the correct z-index #10580
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10580 +/- ##
==========================================
- Coverage 54.66% 54.64% -0.02%
==========================================
Files 249 249
Lines 21932 21943 +11
Branches 3429 3431 +2
==========================================
+ Hits 11989 11991 +2
- Misses 9943 9952 +9
|
10e569e
to
d238b26
Compare
this PR is blocked by #10458 |
d1b494c
to
2eeb806
Compare
@NejcZdovc please confirm if this is ready for review and tag reviewers to check. thanks! |
@cezaraugusto it's ready for a review |
js/actions/windowActions.js
Outdated
@@ -1211,6 +1211,16 @@ const windowActions = { | |||
}, | |||
windowValue | |||
}) | |||
}, | |||
|
|||
onWindowFocus: function (windowId, windowValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to appAction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -332,6 +333,7 @@ const windowsReducer = (state, action, immutableAction) => { | |||
break | |||
case appConstants.APP_WINDOW_CREATED: | |||
state = windowState.maybeCreateWindow(state, action) | |||
windowActions.onWindowFocus(action.getIn(['windowValue', 'windowId']), action.get('windowValue')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can assume that app window created means always focused. You could maybe check the window here and if focused do that if for some reason the focus
event isn't firing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments
I'm not sure about the test plan but I did the following:
is that an accurate test plan? |
for the above windows opened in the reverse order so a, b, c instead of c, b, a. Not sure if that's the expected behavior. |
adc23fd
to
f2a0ba9
Compare
@cezaraugusto yeah I didn't try this scenario, was using keyboard shortcuts only. Nice scenario. This use case should be fixed now. Can you please re-review? @bbondy I rewrote this PR a little bit, so we don't need focus action anymore and detection rate is a lot better |
I will squash commits before merging |
f2a0ba9
to
1b7598d
Compare
loadedPerWindowImmutableState.forEach((wndState) => { | ||
appActions.newWindow(undefined, undefined, wndState) | ||
}) | ||
loadedPerWindowImmutableState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe as a follow up, it would be good to pull out the sorting into something which can easily be unit tested. Maybe a new method determineZindex
or similar (maybe in app/commmon/state/windowState
)
then the below would be like:
const sortedList = windowState.determineZindex(loadedPerWindowImmutableStore)
sortedList.forEach((wndState) => {
appActions.newWindow(undefined, undefined, wndState)
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++!
@@ -788,8 +790,17 @@ const doAction = (action) => { | |||
break | |||
} | |||
case windowConstants.WINDOW_ON_WINDOW_UPDATE: | |||
windowState = windowState.set('windowInfo', action.windowValue) | |||
break | |||
case appConstants.APP_WINDOW_READY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you did a follow up, this would be fairly easy to add a unit test for too 😄 Basically checking that focusTime
gets added to windowInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes work great 😄 👍 I tested on macOS and Windows. Comments left about what could be better (if you wanted to do a follow up). Great job! 😄
I'll hold off on merge if you wanted to squash / address feedback and maybe @bbondy can re-review 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but needs rebase on windowStore.js
Resolves brave#10473 Auditors: Test Plan:
1b7598d
to
2f0dcfb
Compare
@cezaraugusto rebased and squashed |
@@ -2,6 +2,8 @@ | |||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | |||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | |||
|
|||
/* global performance */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just use window.performance and avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NejcZdovc pls revisit this later for follow-up feedbacks, given this is approved by all I'm merging, thanks
Windows are restored with the correct z-index
Submitter Checklist:
git rebase -i
to squash commits (if needed).Resolves #10473
Test Plan:
See #10473
Reviewer Checklist:
Tests