-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: a11y and performance issues with library authoring navigation [FC-0076] #1593
base: master
Are you sure you want to change the base?
fix: a11y and performance issues with library authoring navigation [FC-0076] #1593
Conversation
so that library authoring navigate events don't change element focus.
Thanks for the pull request, @pomegranited! This repository is currently maintained by @openedx/2u-tnl. Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.
|
@pomegranited It seems like the real problem is with the page refresh(fast-page reload via react routes) on clicking any component/collection/library-info that updates the browser url. If you click on any of these objects, all the data like search results, library info etc. is fetched again from server. I am not sure how we can fix that and still have sharable urls. 🥲 |
Oh ya, that's pretty bad :/ I got all excited when I saw the search-manager's useQuery calls pass in @rpenido do you know more about these options and how/whether we could use them here? |
The main issue is that we unmount and mount a new I did some (not exhaustive) tests and think we don't need to do the unmount/mount after changing Alternatively, to make the Also, setting and maintaining this behavior on all hooks will require a lot of work. If we think this is necessary, it will probably be better to set this behavior for the whole app, setting it on the Edit: I found an issue (bug?): If we click a second time on an already selected collection, we are redirected to the collection page. I'm unsure if that was intended, so I "fixed" it on the PR. Feel free to ignore the second commit on the PR if it was intentional, or fix it using another approach (I left some comments on the PR)! |
@pomegranited It's well worth reading the official docs: https://tanstack.com/query/v4/docs/framework/react/reference/useQuery I agree with @rpenido that setting |
Thank you for your help here @rpenido ! I used your
I chose not to include this change though, because I like that "double click card" behaviour -- |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1593 +/- ##
==========================================
+ Coverage 93.23% 93.24% +0.01%
==========================================
Files 1098 1100 +2
Lines 21709 21795 +86
Branches 4593 4703 +110
==========================================
+ Hits 20240 20323 +83
+ Misses 1404 1400 -4
- Partials 65 72 +7 ☔ View full report in Codecov by Sentry. |
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.
@rpenido @pomegranited Nice work! The issue with re-mounting library page is fixed but now opening collection is not working consistently, the first collection page that you open is opened everytime after that even if you click on another collection. And sometimes it also crashes.
I also tested with additional changes that @rpenido has done in open-craft#79
Ah ok -- I ended up re-instating the |
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.
@pomegranited Perfect 👍
- I tested this: (Tested all library tabs and collections pages)
- I read through the code
- I checked for accessibility issues
- Includes documentation
Description
This PR fixes some a11y and performance issues for Library Authors introduced by #1575.
Accessibility
The course content search modal behavior is unchanged -- loading this modal auto-focuses the search input box as one would expect.
Current behavior: see Shareable URLs for library components and searches #1499 (comment)
Fixed behavior: https://github.com/user-attachments/assets/539aad1b-13ae-48da-a5f1-6f15cb6f2e4e
Performance
<LibraryLayout/>
component -- this has been fixed by e92eeb6.staleTime
option is used to control how long data is considered fresh in both queries and routes. By default, thestaleTime
for queries is set to 0 milliseconds, meaning that the data will always be considered stale and will be refetched whenever the query is mounted.244cfc6 fixes this by setting the QueryClient's default
staleTime
to 1 hour.Supporting information
See #1499 (comment)
Private-ref: FAL-3984
Testing instructions
Note that the search input box still has the initial focus, so you can start typing keywords immediately.
Note that the search input box does not capture focus any more.
Note that the API calls to studio are not re-fetched once they're loaded (except for the component iframe, which is loaded every time you load a component, e.g http://studio.local.openedx.io:8001/xblocks/v2/lb:OpenCraft:FAL-3984:html:19b3a1f4-0d98-41d9-82d9-ee5096cb9bf5/embed/student_view/).
Ensure that these changes appear in the UI after save.