Unplanned
Last Updated: 25 Nov 2024 12:27 by ADMIN
Oliver
Created on: 18 Nov 2024 13:39
Category: Window
Type: Feature Request
1
When a window closes, focus returns to the element that invoked the window since 8.1.0

When your window control closes, focus returns to the element that invoked the window unless it is very unlikely users need to immediately reinvoke the window.

We use your window control as a popup search dialog. Our customers search for their data there, close the popup and then return to a dialog with lots of input fields.
The user had previously focused on one of these input fields and would like to have the focus back in this input field after closing the popup.
Which has worked wonderfully up to and including your version 8.0.0.

Unfortunately, this no longer works since version 8.1.0 and instead of the input field, only the button that previously opened the popup is focused. This change from the changelog seems to be responsible for this: "window: update focus management and kb navigation to match the ARIA spec".
It seems that your change uses a setTimeout internally, which keeps taking the focus away from our input field.

You can reproduce this behavior in a demo application. The first application is based on version 8.3.0 and you can reproduce the problem there by pressing the button and closing the opened popup. The focus that was previously in the input field is then on the button. Here: https://stackblitz.com/edit/react-xdpeqc-nycw86?file=app%2Fapp.tsx,package.json
In the second application based on version 8.0.0, you can see that the same process sets the focus directly back to the input field. Here: https://stackblitz.com/edit/react-xdpeqc-yab7m8?file=package.json,app%2Fapp.tsx

Nowhere in the ARIA specification here does it say that you should use a setTimeout to steal the user's focus again at a later time in order to set it on the button that opened the popup. On the contrary, point 2.1 describes exactly what we need:

You already had this feature in version 8.0.0 and could offer it again as a property with very little implementation effort. Please consider to add this old behaviour as a Window Prop again.

1 comment
ADMIN
Yanko
Posted on: 25 Nov 2024 12:27

Hi, Oliver,

Thank you very much for the extensive description of the desired feature request: to add a property to specify where the focus should return after the window is closed. We will monitor the interest in this closely, and if it increases, we will plan and estimate its implementation, and you will be notified when that happens. 

As we discussed earlier, I can suggest using the `onClose` property of the window to overwrite the default behaviour, which focuses the element that opened the window, and focus a different element. Below is the demo that I previously prepared, as a workaround that displays the above approach, in our previous discussion, so that other people can find it here:

Regards,
Yanko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.