From ac037948db22f1a436d7ebeb63c75fb15bf4a180 Mon Sep 17 00:00:00 2001 From: Filip Siderov Date: Fri, 22 Mar 2019 11:08:25 +0200 Subject: [PATCH 1/3] fix(ui5-radiobutton): fix keyboard handling on tab/shift + tab --- packages/main/src/RadioButtonTemplateContext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/main/src/RadioButtonTemplateContext.js b/packages/main/src/RadioButtonTemplateContext.js index f6ad2396267f..f73f42dcc7e9 100644 --- a/packages/main/src/RadioButtonTemplateContext.js +++ b/packages/main/src/RadioButtonTemplateContext.js @@ -25,7 +25,7 @@ class RadioButtonTemplateContext { context = { ctr: state, readOnly: state.disabled || state.readOnly, - tabIndex: state.disabled ? undefined : "0", + tabIndex: state.disabled || !state.selected ? "-1" : "0", circle: compact ? SVGConfig.compact : SVGConfig.default, classes: { main: mainClasses, inner: innerClasses }, styles: { From 0131529a93366b50aee1dfa9a226ca26a319d7be Mon Sep 17 00:00:00 2001 From: Filip Siderov Date: Fri, 22 Mar 2019 12:55:51 +0200 Subject: [PATCH 2/3] fix tests --- packages/main/src/RadioButtonTemplateContext.js | 2 +- packages/main/test/specs/RadioButton.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/main/src/RadioButtonTemplateContext.js b/packages/main/src/RadioButtonTemplateContext.js index f73f42dcc7e9..979650ffacbd 100644 --- a/packages/main/src/RadioButtonTemplateContext.js +++ b/packages/main/src/RadioButtonTemplateContext.js @@ -25,7 +25,7 @@ class RadioButtonTemplateContext { context = { ctr: state, readOnly: state.disabled || state.readOnly, - tabIndex: state.disabled || !state.selected ? "-1" : "0", + tabIndex: state.disabled || (!state.selected && state.group) ? "-1" : "0", circle: compact ? SVGConfig.compact : SVGConfig.default, classes: { main: mainClasses, inner: innerClasses }, styles: { diff --git a/packages/main/test/specs/RadioButton.spec.js b/packages/main/test/specs/RadioButton.spec.js index 92c31cff888e..b72c6b0ed820 100644 --- a/packages/main/test/specs/RadioButton.spec.js +++ b/packages/main/test/specs/RadioButton.spec.js @@ -20,7 +20,7 @@ describe("RadioButton general interaction", () => { const field = browser.findElementDeep("#field"); radioButton1.click(); - radioButton1.keys("Tab"); + radioButton1.keys("ArrowDown"); radioButton2.keys("Enter"); assert.strictEqual(field.getProperty("value"), "2", "Select event should be fired one more time."); @@ -35,7 +35,7 @@ describe("RadioButton general interaction", () => { const field = browser.findElementDeep("#field"); radioButton1.click(); - radioButton1.keys("Tab"); + radioButton1.keys("ArrowDown"); radioButton2.keys("Space"); assert.strictEqual(field.getProperty("value"), "3", "Select event should be fired one more time."); From d2112f666ffb593023263ee5e5857ce42602dec3 Mon Sep 17 00:00:00 2001 From: Filip Siderov Date: Mon, 25 Mar 2019 09:41:43 +0200 Subject: [PATCH 3/3] fix failing tests --- packages/main/test/specs/RadioButton.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/main/test/specs/RadioButton.spec.js b/packages/main/test/specs/RadioButton.spec.js index b72c6b0ed820..92c31cff888e 100644 --- a/packages/main/test/specs/RadioButton.spec.js +++ b/packages/main/test/specs/RadioButton.spec.js @@ -20,7 +20,7 @@ describe("RadioButton general interaction", () => { const field = browser.findElementDeep("#field"); radioButton1.click(); - radioButton1.keys("ArrowDown"); + radioButton1.keys("Tab"); radioButton2.keys("Enter"); assert.strictEqual(field.getProperty("value"), "2", "Select event should be fired one more time."); @@ -35,7 +35,7 @@ describe("RadioButton general interaction", () => { const field = browser.findElementDeep("#field"); radioButton1.click(); - radioButton1.keys("ArrowDown"); + radioButton1.keys("Tab"); radioButton2.keys("Space"); assert.strictEqual(field.getProperty("value"), "3", "Select event should be fired one more time.");