Bad control behaviour in docs view due to stolen focus
The following discussion from !2697 (merged) should be addressed:
-
@pslaughter started a discussion: (+2 comments) issue: Are we aware that the key event handling on the doc page make using the
Set string
andSet object
buttons unusable?Screencast_2022-03-20_19_55_21
Is this a problem with all components or just this one?
Ah, I see, it's because of the
mounted
behaviour to open the dropdown when the story is mounted🤦 Changing a control's value causes the story/component to be remounted, which removes focus. You can see this also affects the GlSorting story.A couple of ways we could fix this:
- Reimplement the
mounted
behaviour to not steal focus - Only run the
mounted
behaviour for storyshots; or, everywhere but the docs view
Note that this only affects the docs view and not the canvas view, since the latter's controls are in a different document, so focus cannot be stolen.
- Reimplement the