-
Notifications
You must be signed in to change notification settings - Fork 22
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 focus in create resource #2367
Comments
Hi @Macroz I'm happy to tackle this one. I've had a quick look at the codebase and can see where the focus is going. Did you have a specific solution in mind or should I just try open a PR and get your thoughts? |
Great! No specific solution but I urge you to have a look at what we have done elsewhere by looking for |
Hi @Macroz, I've got a few questions about this issue, it seems to be a little trickier than I originally anticipated. I've identified a few problems which makes this a little challenging. Firstly, I noticed that there is a root My initial solution was to add custom focus classes to each of the first children in the forms and query for that class (via What are your thoughts? |
Good questions and thinking. I think the idea was to move the focus initially to a relevant element. However, it is not working correctly. Typically forms would/should(?) focus the first input element, and obviously here it didn't work so. I think for pages where there are no inputs, the idea was to focus something else instead. However I know that there should be the "skip to main content link" that you can navigate to backwards, so I wonder why the autojump is there. These are all related to accessibility requirements. I'll dig around for the answer a bit. I couldn't find anything quickly that would specify how the initial focus should be set. Only that e.g. navigation and focus must be logical. The logic can really only be tested with NVDA on Windows or such setup and I can do that out once we have some solution to try. I'll get back to you! |
I had a look at some accessibility documents and I think that although it is not exactly specified, the best practice seems to be to focus the I think all the editors in the admin pages have the exact same problem that the focus is not in the |
Anything we can help you with @BadAlgorithm? |
Hey @Macroz Sorry, I've been out of action for a couple of weeks. I think the solution that you've proposed works and I've just tried it out. Seems to work well and will navigate to the correct input fields in the forms by default (as far as my testing has seen). One thing that I did notice in my testing is that it does not capture focus when the page is refreshed, is this something we would like to support? If this is the case a solution I can think of is to change the lifecycle on when we call the function to focus the h1 element (since it's not mounted when main app is mounted). What are your thoughts? I can refer you to my fork if you wanted more information |
Hopefully nothing serious! Sounds good. I think perhaps the first PR should just fix the focus when navigating and then if you have the chance a second PR could solve the page refresh. I'm happy to review a draft PR too if you want early comments or specific help but sounds like you have the |
@BadAlgorithm do you want to continue on this issue or shall we finish it? |
https://developers.google.com/web/fundamentals/accessibility/focus To continue the discussion, I do not see explicitly |
This is my understanding: we use |
right, thanks for clarification @opqdonut |
I assume my surrent solution with #2367 does not work for you then? |
Yeah at least it's not in line with the current approach we have. We can have a discussion about this focus stuff with the team and figure out a new approach of course if there are problems with the old one. |
well, the way I see it it currently had a focus on h1 element according to previous implementation, so adding focus on the first field in form is not relevant anymore? |
I've not kept up with the developments in this ticket, but this comment from @Macroz above seems to be the current spec:
|
ok, so I understood the task correctly then |
I just checked all the Create catalogue item / resource / form / workflow / organization pages and they all work correctly:
So I think this issue is done, or am I missing something @Macroz ? |
Maybe just the idea task for the page refresh behavior (that should be the same). |
When choosing
Administration
, thenResources
and finallyCreate
, the focus should be in the first field but it seems to disappear.The text was updated successfully, but these errors were encountered: