Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router/common: Refactors and fixes the BrowserViewportScroller's scrolling behavior #40241

Closed
wants to merge 3 commits into from

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Dec 22, 2020

Refactors and fixes the BrowserViewportScroller's scrolling behavior.

Commit 1:
The BrowserViewportScroller injects but does not use the ErrorHandler.
This commit removes the ErrorHandler from the constructor.

Commit 2:
The current tests in the router scroller are
change-detector tests
and do not ensure the correct behavior of the scroller.
This commit updates the tests to assert actual scrolling behavior of the
browser.

Commit 3:
According to the spec,
we should attempt to set the browser focus after scrolling to a
fragment. Note that this change does not exactly follow the robust steps
outlined in the spec by finding a fallback target if the original is not
focusable. Instead, we simply attempt to focus the element by calling
focus on it, which will do nothing if the element is not focusable.

fixes #30067

@google-cla google-cla bot added the cla: yes label Dec 22, 2020
The `BrowserViewportScroller` injects but does not use the `ErrorHandler`.
This commit removes the `ErrorHandler` from the constructor.
@atscott atscott force-pushed the routerscroller branch from 85aff66 to 8193224 Dec 22, 2020
The current tests in the router scroller are
[change-detector tests](https://testing.googleblog.com/2015/01/testing-on-toilet-change-detector-tests.html)
and do not ensure the correct behavior of the scroller.
This commit updates the tests to assert actual scrolling behavior of the
browser.
@atscott atscott force-pushed the routerscroller branch from 8193224 to 193493f Dec 22, 2020
@atscott
Copy link
Contributor Author

@atscott atscott commented Dec 22, 2020

@atscott atscott force-pushed the routerscroller branch 2 times, most recently from be21305 to bf363b4 Dec 22, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 23, 2020
@atscott atscott changed the title Routerscroller Router/common: Refactors and fixes the BrowserViewportScroller's scrolling behavior Dec 28, 2020
@atscott atscott marked this pull request as ready for review Dec 28, 2020
@atscott atscott requested a review from petebacondarwin Dec 28, 2020
packages/common/src/viewport_scroller.ts Outdated Show resolved Hide resolved
packages/common/src/viewport_scroller.ts Outdated Show resolved Hide resolved
packages/common/src/viewport_scroller.ts Outdated Show resolved Hide resolved
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid),
we should attempt to set the browser focus after scrolling to a
fragment. Note that this change does not exactly follow the robust steps
outlined in the spec by finding a fallback target if the original is not
focusable. Instead, we simply attempt to focus the element by calling
`focus` on it, which will do nothing if the element is not focusable.

fixes angular#30067
@atscott atscott requested a review from petebacondarwin Dec 28, 2020
josephperrott added a commit that referenced this issue Jan 5, 2021
…#40241)

The `BrowserViewportScroller` injects but does not use the `ErrorHandler`.
This commit removes the `ErrorHandler` from the constructor.

PR Close #40241
josephperrott added a commit that referenced this issue Jan 5, 2021
The current tests in the router scroller are
[change-detector tests](https://testing.googleblog.com/2015/01/testing-on-toilet-change-detector-tests.html)
and do not ensure the correct behavior of the scroller.
This commit updates the tests to assert actual scrolling behavior of the
browser.

PR Close #40241
josephperrott added a commit that referenced this issue Jan 5, 2021
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid),
we should attempt to set the browser focus after scrolling to a
fragment. Note that this change does not exactly follow the robust steps
outlined in the spec by finding a fallback target if the original is not
focusable. Instead, we simply attempt to focus the element by calling
`focus` on it, which will do nothing if the element is not focusable.

fixes #30067

PR Close #40241
josephperrott added a commit that referenced this issue Jan 5, 2021
The current tests in the router scroller are
[change-detector tests](https://testing.googleblog.com/2015/01/testing-on-toilet-change-detector-tests.html)
and do not ensure the correct behavior of the scroller.
This commit updates the tests to assert actual scrolling behavior of the
browser.

PR Close #40241
josephperrott added a commit that referenced this issue Jan 5, 2021
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid),
we should attempt to set the browser focus after scrolling to a
fragment. Note that this change does not exactly follow the robust steps
outlined in the spec by finding a fallback target if the original is not
focusable. Instead, we simply attempt to focus the element by calling
`focus` on it, which will do nothing if the element is not focusable.

fixes #30067

PR Close #40241
twerske added a commit to twerske/angular that referenced this issue Jan 5, 2021
…angular#40241)

The `BrowserViewportScroller` injects but does not use the `ErrorHandler`.
This commit removes the `ErrorHandler` from the constructor.

PR Close angular#40241
twerske added a commit to twerske/angular that referenced this issue Jan 5, 2021
The current tests in the router scroller are
[change-detector tests](https://testing.googleblog.com/2015/01/testing-on-toilet-change-detector-tests.html)
and do not ensure the correct behavior of the scroller.
This commit updates the tests to assert actual scrolling behavior of the
browser.

PR Close angular#40241
twerske added a commit to twerske/angular that referenced this issue Jan 5, 2021
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid),
we should attempt to set the browser focus after scrolling to a
fragment. Note that this change does not exactly follow the robust steps
outlined in the spec by finding a fallback target if the original is not
focusable. Instead, we simply attempt to focus the element by calling
`focus` on it, which will do nothing if the element is not focusable.

fixes angular#30067

PR Close angular#40241
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Feb 5, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants