Skip to content

Commit eb9ca88

Browse files
committed
focusable
1 parent 47fce96 commit eb9ca88

File tree

1 file changed

+25
-0
lines changed
  • services/static-webserver/client/source/class/osparc/ui/form

1 file changed

+25
-0
lines changed

services/static-webserver/client/source/class/osparc/ui/form/IntlTelInput.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
2929
construct: function() {
3030
this.base(arguments);
3131

32+
this.setFocusable(true);
33+
3234
this._setLayout(new qx.ui.layout.HBox());
3335

3436
this.getContentElement().setStyles({
@@ -65,6 +67,7 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
6567

6668
members: {
6769
__htmlId: null,
70+
__inputElement: null,
6871
__itiInput: null,
6972

7073
_createChildControlImpl: function(id) {
@@ -101,6 +104,27 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
101104
},
102105
// IStringForm interface implementation
103106

107+
// Make the widget tabbable/focusable
108+
focus: function() {
109+
if (this.__inputElement) {
110+
this.__inputElement.focus();
111+
} else {
112+
// fallback: let qooxdoo focus the content element
113+
this.base(arguments);
114+
}
115+
},
116+
117+
tabFocus: function() {
118+
this.focus();
119+
},
120+
121+
getFocusElement: function() {
122+
const phoneNumber = this.getChildControl("phone-input-field");
123+
// phoneNumber is a qx.ui.embed.Html → it has a ContentElement (qx.html.Element)
124+
return phoneNumber.getContentElement();
125+
},
126+
// Make the widget tabbable/focusable
127+
104128
_applyValue: function(value) {
105129
this.fireDataEvent("changeValue", value);
106130
},
@@ -198,6 +222,7 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
198222
},
199223

200224
__inputToPhoneInput: function(input) {
225+
this.__inputElement = input; // keep reference to raw <input>
201226
const iti = intlTelInput(input, {
202227
initialCountry: "auto",
203228
geoIpLookup: callback => {

0 commit comments

Comments
 (0)