Keyboard layout change not working on first attempt
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=435631)
</details>
<!--IssueSummary end-->
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "regression" or "type::bug" label:
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug
and verify the issue you're about to submit isn't a duplicate.
--->
### Summary
<!-- Summarize the bug encountered concisely. -->
Currently, the default keyboard layout of the web IDE is `us` (bottom right). Some users would prefer changing the layout but there seems to be a bug in doing so.
Though not easily reproducible, at times if you want to switch to a different layout in the list, upon clicking the layout, it still remains as `us`. Sometimes you have to pick a different layout, then pick the desired layout for it to change.
I have tested this out with a random GitLab version (16.3.4) but this is also reproducible in GitLab.com
### Steps to reproduce
<!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. -->
- Open the web IDE, not that the default is `US`.
- Try and select `fr`.
- Note that sometimes, `fr` is not selected as the layout (bottom right)
- To solve it, pick a different layout, for example `de`, then pick `fr`. The layout will switch to `de` then `fr`.
- sometimes it needs a page refresh to select the correct layout on the first try.
### What is the current *bug* behavior?
<!-- Describe what actually happens. -->
Desired layout is not selected on the first attempt. One needs to select another layout in the list, then select the desired layout e.g. from `us` to `de` to desired layout (`fr`).
### What is the expected *correct* behavior?
<!-- Describe what you should see instead. -->
Desired layout should be selected on the first attempt
### Relevant logs and/or screenshots
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->
Video recording of behavior:

### Output of checks
<!-- If you are reporting a bug on GitLab.com, uncomment below -->
<!-- This bug happens on GitLab.com -->
<!-- /label ~"reproduced on GitLab.com" -->
#### Results of GitLab environment info
<!-- Input any relevant GitLab environment information if needed. -->
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
</pre>
</details>
#### Results of GitLab application Check
<!-- Input any relevant GitLab application check information if needed. -->
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:check SANITIZE=true`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
</pre>
</details>
### Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
issue