From 1ea0893643de5aeb1a7743d0e1ce8c12c7ab25ea Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Fri, 24 Mar 2023 12:43:04 -0700 Subject: [PATCH] refactor(radio-group): switch ev.code to ev.key (#27021) Co-authored-by: Sean Perkins --- core/src/components/radio-group/radio-group.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/components/radio-group/radio-group.tsx b/core/src/components/radio-group/radio-group.tsx index d581d1af6a..9d00f21ef0 100644 --- a/core/src/components/radio-group/radio-group.tsx +++ b/core/src/components/radio-group/radio-group.tsx @@ -126,13 +126,13 @@ export class RadioGroup implements ComponentInterface { // 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 (['ArrowDown', 'ArrowRight'].includes(ev.code)) { + if (['ArrowDown', 'ArrowRight'].includes(ev.key)) { next = index === radios.length - 1 ? radios[0] : radios[index + 1]; } // 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 (['ArrowUp', 'ArrowLeft'].includes(ev.code)) { + if (['ArrowUp', 'ArrowLeft'].includes(ev.key)) { next = index === 0 ? radios[radios.length - 1] : radios[index - 1]; } @@ -146,7 +146,7 @@ export class RadioGroup implements ComponentInterface { // Update the radio group value when a user presses the // space bar on top of a selected radio - if (['Space'].includes(ev.code)) { + if ([' '].includes(ev.key)) { this.value = this.allowEmptySelection && this.value !== undefined ? undefined : current.value; // Prevent browsers from jumping