diff --git a/packages/main/src/ComboBox.hbs b/packages/main/src/ComboBox.hbs index 6f18badef003..e9099f20c46f 100644 --- a/packages/main/src/ComboBox.hbs +++ b/packages/main/src/ComboBox.hbs @@ -23,6 +23,7 @@ aria-describedby="{{valueStateTextId}}" aria-label="{{ariaLabelText}}" aria-required="{{required}}" + data-sap-focus-ref /> {{#if icon}} diff --git a/packages/main/test/pages/ComboBox.html b/packages/main/test/pages/ComboBox.html index e6ec96b390d8..f3fdb039a6b5 100644 --- a/packages/main/test/pages/ComboBox.html +++ b/packages/main/test/pages/ComboBox.html @@ -54,6 +54,7 @@ + Focus ComboBox
@@ -276,6 +277,10 @@

ComboBox in Compact

document.getElementById("value-set-btn").addEventListener("click", function (event) { document.getElementById("combo").value = "new value"; }); + + document.getElementById("combo-focus").addEventListener("click", function () { + document.getElementById("combo").focus(); + }); diff --git a/packages/main/test/specs/ComboBox.spec.js b/packages/main/test/specs/ComboBox.spec.js index c3b3cb73cb55..31c13ebc5d7b 100644 --- a/packages/main/test/specs/ComboBox.spec.js +++ b/packages/main/test/specs/ComboBox.spec.js @@ -492,4 +492,15 @@ describe("Accessibility", () => { assert.strictEqual(combo.getProperty("value"), "new value", "ComboBox value should be set to 'new value'"); assert.strictEqual(inner.getProperty("value"), "new value", "ComboBox value should be set to 'new value'"); }); + + it ("Should focus the ComboBox with the API", () => { + browser.url(`http://localhost:${PORT}/test-resources/pages/ComboBox.html`); + + const combo = $("#combo"); + const focusBtn = $("#combo-focus"); + + focusBtn.click(); + + assert.ok(combo.getProperty("focused"), "ComboBox to be focused"); + }); });