chore: Globally handle focus-visible management for application spanning multiple iframes #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available: AWSUI-60845
Description of changes: Supporting the niche but real use case where components are rendered into a same-origin iframe (typically using a React portal). We keep the reference counting logic, but extend it so that each frame (including the main one) has its own count. This should release first - the matching PR for the components package will follow.
Check my dev pipeline (AwsUi-v3-dwaraa) to see what it looks like.
This is a stopgap to resolve this issue so that the CSS focus-visible migration isn't tied to this simple bugfix. The "default keyboard" approach of the browser behavior compared to the "default mouse" approach of the JS implementation means that there are some async or initial page load scenarios where the focus ring appears where it previously didn't. Some cases may need fixing, some cases we can live with, but that investigation is a separate topic.
Also, as you can tell from the tests, this only works if Cloudscape components are mounted in all the frames where detection needs to happen. Maybe there's a better approach, but at the same time, it also makes sense that I shouldn't start digging up into parent iframes to listen to events if the application isn't even rendered there.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.