sfbrigade / bats-server

Routed is an app to help ambulances direct non-critical patients to hospital emergency rooms with the most availability.
https://routedapp.org/
GNU Affero General Public License v3.0
18 stars 12 forks source link

EMS: after clicking Select Hospital, the keyboard focus is not reset when the selection page appears #242

Open fwextensions opened 1 year ago

fwextensions commented 1 year ago

result: the Send Ringdown button is focused.

expected: the first radio button in the hospital list should be selected.

holliskuang commented 1 year ago

Hi, took a look here. From what I can tell, the issue may stem from the way the Ringdown Form is structured:

{(Step 0) render }
{(Step 1) render }

{(Step 0) render } {(Step 1) render }

When the SelectHospital button is selected, the focus jumps to the buttons and seems to remain there for the newly rendered components.

A solution may be to restructure the Step 0s together, then the Step 1s together: {(Step 0) render } {(Step 0) render }

{(Step 1) render } {(Step 1) render }

Therefore, when the Select Hospital Button is clicked, the next tab will naturally be the Hospital Selections without having to mess with tabIndex. Unsure if there are any unintended consequences with this, but everything seems to work fine on my side.