@abgov/jsonforms-components 1.41.3 → 1.41.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.esm.js +12 -8
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -4581,6 +4581,16 @@ const Dropdown = props => {
4581
4581
  }
4582
4582
  setIsOpen(false);
4583
4583
  };
4584
+ const setInputTextFocus = () => {
4585
+ const inputEl = document.getElementById(`${id}-input`);
4586
+ if (inputEl) {
4587
+ //The 'focused' property is part of the GoAInput component that is used to
4588
+ //set focus on the input field. We need to set it back to false once we set focus on the input field. Doing with just .focus() doesnt work.
4589
+ inputEl.focused = true;
4590
+ inputEl.focus();
4591
+ inputEl.focused = false;
4592
+ }
4593
+ };
4584
4594
  const setElementFocus = (e, element, preventDefault) => {
4585
4595
  if (element) {
4586
4596
  element.focus();
@@ -4601,6 +4611,7 @@ const Dropdown = props => {
4601
4611
  if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4602
4612
  setIsOpen(previousIsOpen => !previousIsOpen);
4603
4613
  const el = document.getElementById(`${PREFIX}-${label}-${(_a = items.at(0)) === null || _a === void 0 ? void 0 : _a.value}`);
4614
+ setInputTextFocus();
4604
4615
  setElementFocus(e, el, false);
4605
4616
  } else if (e.key === ARROW_UP_KEY) {
4606
4617
  setIsOpen(true);
@@ -4637,14 +4648,7 @@ const Dropdown = props => {
4637
4648
  var _a, _b, _c, _d;
4638
4649
  if (e.key === ENTER_KEY || e.key === SPACE_KEY) {
4639
4650
  updateDropDownData(item);
4640
- const inputEl = document.getElementById(`${id}-input`);
4641
- if (inputEl) {
4642
- //The 'focused' property is part of the GoAInput component that is used to
4643
- //set focus on the input field. We need to set it back to false once we set focus on the input field. Doing with just .focus() doesnt work.
4644
- inputEl.focused = true;
4645
- inputEl.focus();
4646
- inputEl.focused = false;
4647
- }
4651
+ setInputTextFocus();
4648
4652
  }
4649
4653
  if (e.key === ESCAPE_KEY) {
4650
4654
  setIsOpen(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.41.3",
3
+ "version": "1.41.4",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",