Bump @gitlab/ui to 137.2.7 to fix GlFilteredSearch blur handler crash in jsdom
What does this MR do and why?
Problem
In jsdom (the Jest test environment), a blur event fires with
relatedTarget set to document when a focused input unmounts — for
example, right after submitting a filtered search. document is not
null, so the existing optional chain
e.relatedTarget?.classList.contains(...) in GlFilteredSearch's token
segment blur handler does not short-circuit. Calling .contains(...)
on undefined (a Document node has no classList) throws a
TypeError and crashes the test.
Real browsers are not affected: the DOM spec guarantees that a blur
event's relatedTarget is always an Element or null. The crash is
exclusive to the jsdom test environment and has no impact on production
behaviour.
Fix
Bumps @gitlab/ui from 137.2.5 to 137.2.7, which includes the
upstream fix
(gitlab-org/gitlab-services/design.gitlab.com!6377 (merged)):
the blur handler now uses
e.relatedTarget?.classList?.contains(...).
Spec cleanup
The submitSearch helper in
ee/spec/frontend/integration/commits/commit_list_filtered_search_spec.js
manually focused the search button before clicking it solely to avoid
the crash. With the root cause fixed that workaround is removed; the
helper now simply waits for the button and clicks it.
yarn jest:integration ee/spec/frontend/integration/commits/ passes:
5 suites, 29 tests.
References
- Upstream fix MR: gitlab-org/gitlab-services/design.gitlab.com!6377 (merged) (released in
@gitlab/ui@137.2.7) - Tracked as: gitlab-org/gitlab-services/design.gitlab.com#3663 (closed)
Screenshots or screen recordings
No UI changes (test-environment-only fix; production behaviour unchanged).