Checks whether a keycode is one of the configured separators.
(event: KeyboardEvent)
| 241 | |
| 242 | /** Checks whether a keycode is one of the configured separators. */ |
| 243 | private _isSeparatorKey(event: KeyboardEvent): boolean { |
| 244 | if (!this.separatorKeyCodes) { |
| 245 | return false; |
| 246 | } |
| 247 | |
| 248 | for (const key of this.separatorKeyCodes) { |
| 249 | let keyCode: number; |
| 250 | let modifiers: readonly ModifierKey[] | null; |
| 251 | |
| 252 | if (typeof key === 'number') { |
| 253 | keyCode = key; |
| 254 | modifiers = null; |
| 255 | } else { |
| 256 | keyCode = key.keyCode; |
| 257 | modifiers = key.modifiers; |
| 258 | } |
| 259 | |
| 260 | const modifiersMatch = !modifiers?.length |
| 261 | ? !hasModifierKey(event) |
| 262 | : hasModifierKey(event, ...modifiers); |
| 263 | |
| 264 | if (keyCode === event.keyCode && modifiersMatch) { |
| 265 | return true; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | return false; |
| 270 | } |
| 271 | |
| 272 | /** Gets the value to set on the `readonly` attribute. */ |
| 273 | protected _getReadonlyAttribute(): string | null { |
no test coverage detected