fix: Align answer submission notification to bottom of viewport if out of view#27022
Conversation
|
Thanks for the pull request, @arjunsinghy96! I've created OSPR-5673 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
|
jenkins run a11y |
1 similar comment
|
jenkins run a11y |
|
@arjunsinghy96 Thank you for your contribution. Please let me know once it is ready for our review. |
|
jenkins run a11y |
Agrendalath
left a comment
There was a problem hiding this comment.
@arjunsinghy96, I found some typos. I haven't checked the code.
cc: @viadanna
b7b4835 to
ac9a679
Compare
935d2cb to
f471bc1
Compare
|
@natabene Thanks for the patience. This PR is now ready for edx review. |
|
Good to go 👍
|
|
@sarina This is ready for your team to review. |
There was a problem hiding this comment.
It's a small thing, but if you reverse the clauses in this conditional then you won't do the viewport calculation for anything except the notification-btn. If there are a lot of elements, it could reduce the work being done here.
if (elem.classList.contains('notification-btn') && !isInViewport(elem)) {
That'll short circuit if the element's class list doesn't contain notification-btn, avoiding the call to isInViewport.
There was a problem hiding this comment.
Do you have a sense of how often this focus function is called? It seems like we're overriding it for all calls on this page... I'd just want to sanity check that we're not adding a whole bunch of processing to the page when we loop through this.each below.
There was a problem hiding this comment.
@davidjoy Thanks for the review and suggestion. I am working on it this week.
Do you have a sense of how often this focus function is called?
I will try to get some metric on this and update you by end of the week.
There was a problem hiding this comment.
@davidjoy Following is the frequency of focus function calls:
focusis calledtwicewhen rendering the sequence i.e by Sequence.render. It is called on first render of page as well as whenever the active sequence is changed by clicking onNext,Previousor the sequence button.focusis calledtwicefor each Problem in the xblock when rendering. So, if the sequence hasnproblems,focuswill be calledn*2times.focusis calledoncewhen renderingdiscussionson the sequence (xblock).focusis calledtwicefor videos in the sequence (xblock)- For staff users,
focusis called once when rendering the staff toolbar on top of the page.
Additionally, focus is called twice by calculator.js on first render of the page.
Please let me know you further thoughts.
I tried attaching a delegated (ref) event handler on .notification-btn but the browser behaviour was preceded by the event handler callback. The notification was already moved to centre of page before the callback function ran.
davidjoy
left a comment
There was a problem hiding this comment.
Had a suggestion and a question. In general this looks like an improvement, just want to be cautious of any overhead we're adding!
|
📣 💥 Heads-up: You must either rebase onto master or merge master into your branch to avoid breaking the build. We recently removed diff-quality and introduced lint-amnesty. This means that the automated quality check that has run on your branch doesn't work the same way it will on master. If you have introduced any quality failures, they might pass on the PR but then break the build on master. This branch has been detected to not have commit 2e33565 as an ancestor. Here's how to see for yourself: If you have any questions, please reach out to the Architecture team (either #edx-shared-architecture on Open edX Slack or #architecture on edX internal). |
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath
f471bc1 to
c9e6043
Compare
|
Your PR has finished running tests. There were no failures. |
|
This looks good - I tested it and it's a definite improvement. 👍🏻 Waiting for checks to finish and will then merge it. |
|
@arjunsinghy96 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
|
EdX Release Notice: This PR has been rolled back from the production environment. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath (cherry picked from commit 52ab785)
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath (cherry picked from commit 52ab785)
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath (cherry picked from commit 52ab785)
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath (cherry picked from commit 52ab785)
On focus to the answer submition notification, the notification was scrolled to center of screen. This behaviour was on Chrome(87+) browser. This commits overrides the focus jQuery plugin to set the alignment of answer notifications to the bottom of the viewport. Fix the custom focus jQuery plugin Co-authored-by: Agrendalath (cherry picked from commit 52ab785)
Description
This PR changes the alignment of answer submission notification. Currently the notification is aligned vertically centred if not in viewport. This behaviour was observed in Chrome browser (87+). The alignment was correct when tested on Mozilla Firefox (86.0)
JIRA Tickets: BB-3828
Sandbox URL: TBD
Screenshots
Before

After:

Testing instructions
a. Verify that the notification is scrolled to the bottom of the viewport when not in viewport.
b. With notification in viewport, submit another answer
c. Verify that the page does not scroll.
Deadline
None
Reviewers