@ministryofjustice/hmpps-connect-dps-shared-items 3.3.1 → 3.4.0

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.
@@ -80,6 +80,7 @@ export class AutosuggestUi {
80
80
  this.input.addEventListener('keyup', this.handleKeyup.bind(this))
81
81
  this.input.addEventListener('input', this.handleChange.bind(this))
82
82
  this.input.addEventListener('blur', this.handleBlur.bind(this))
83
+ this.input.addEventListener('focus', this.handleFocus.bind(this))
83
84
  }
84
85
 
85
86
  handleKeydown(event) {
@@ -144,10 +145,23 @@ export class AutosuggestUi {
144
145
  // Timeout required to allow user to click an option before clearing the listbox:
145
146
  this.blurTimeout = setTimeout(() => {
146
147
  this.blurring = false
147
- this.clearListbox()
148
+
149
+ this.context.classList.remove(`${this.stylingBaseClass}${classSuffixHasResults}`)
150
+ this.input.removeAttribute('aria-activedescendant')
151
+ this.input.setAttribute('aria-expanded', false)
152
+ this.setAriaStatus()
148
153
  }, 300)
149
154
  }
150
155
 
156
+ handleFocus() {
157
+ if (this.listbox.innerHTML) {
158
+ this.context.classList.add(`${this.stylingBaseClass}${classSuffixHasResults}`)
159
+ this.input.addAttribute('aria-activedescendant')
160
+ this.input.setAttribute('aria-expanded', true)
161
+ this.setAriaStatus()
162
+ }
163
+ }
164
+
151
165
  handleScroll(option, scrollUp) {
152
166
  clearTimeout(this.scrollTimeout)
153
167
  this.scrolling = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ministryofjustice/hmpps-connect-dps-shared-items",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "A package to share Connect DPS functionality across applications",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.esm.js",
@@ -48,7 +48,8 @@
48
48
  "url": "https://github.com/ministryofjustice/hmpps-connect-dps-shared-items-package/issues"
49
49
  },
50
50
  "devDependencies": {
51
- "@ministryofjustice/eslint-config-hmpps": "^1.0.1",
51
+ "@ministryofjustice/eslint-config-hmpps": "^1.0.2",
52
+ "@ministryofjustice/hmpps-npm-script-allowlist": "0.0.3",
52
53
  "@ministryofjustice/hmpps-precommit-hooks": "^1.0.2",
53
54
  "@rollup/plugin-commonjs": "^29.0.0",
54
55
  "@rollup/plugin-multi-entry": "^7.1.0",
@@ -57,20 +58,19 @@
57
58
  "@tsconfig/node24": "24.0.4",
58
59
  "@types/jest": "^30.0.0",
59
60
  "@types/superagent": "^8.1.9",
60
- "govuk-frontend": "^5.13.0",
61
+ "govuk-frontend": "^5.14.0",
61
62
  "jest": "^30.2.0",
62
63
  "jest-html-reporter": "^4.3.0",
63
64
  "jest-junit": "^16.0.0",
64
65
  "lint-staged": "^16.2.7",
65
66
  "nock": "^14.0.10",
66
- "rollup": "4.55.2",
67
+ "rollup": "4.55.3",
67
68
  "rollup-plugin-dts": "^6.3.0",
68
69
  "ts-jest": "^29.4.6",
69
70
  "tslib": "^2.8.1",
70
71
  "typescript": "5.9.3"
71
72
  },
72
73
  "dependencies": {
73
- "@ministryofjustice/hmpps-npm-script-allowlist": "0.0.3",
74
74
  "@ministryofjustice/hmpps-rest-client": "^1.0.0",
75
75
  "@types/bunyan": "^1.8.11",
76
76
  "fuse.js": "^7.1.0",