refactor(alert): switch ev.code to ev.key (#27023)

This commit is contained in:
Maria Hutt
2023-03-24 13:31:30 -07:00
committed by GitHub
parent 1ea0893643
commit a396e8857b

View File

@ -185,13 +185,13 @@ export class Alert implements ComponentInterface, OverlayInterface {
// If hitting arrow down or arrow right, move to the next radio // If hitting arrow down or arrow right, move to the next radio
// If we're on the last radio, move to the first radio // If we're on the last radio, move to the first radio
if (['ArrowDown', 'ArrowRight'].includes(ev.code)) { if (['ArrowDown', 'ArrowRight'].includes(ev.key)) {
nextEl = index === radios.length - 1 ? radios[0] : radios[index + 1]; nextEl = index === radios.length - 1 ? radios[0] : radios[index + 1];
} }
// If hitting arrow up or arrow left, move to the previous radio // If hitting arrow up or arrow left, move to the previous radio
// If we're on the first radio, move to the last radio // If we're on the first radio, move to the last radio
if (['ArrowUp', 'ArrowLeft'].includes(ev.code)) { if (['ArrowUp', 'ArrowLeft'].includes(ev.key)) {
nextEl = index === 0 ? radios[radios.length - 1] : radios[index - 1]; nextEl = index === 0 ? radios[radios.length - 1] : radios[index - 1];
} }