-
Notifications
You must be signed in to change notification settings - Fork 54
feat(FocusZone): Add embed mode for FocusZone and new Chat behavior #233
Conversation
}, | ||
keyActions: { | ||
root: { | ||
focus: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ever used as a focus
action? Or is it more something like regainFocus
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used when you want to unfocus a message and focus the whole list again, so Juraj and I think that focus
is an appropriate action name as the only thing it does is it literally focuses the chat. :)
Codecov Report
@@ Coverage Diff @@
## master #233 +/- ##
==========================================
- Coverage 91.8% 91.67% -0.13%
==========================================
Files 63 63
Lines 1171 1189 +18
Branches 173 153 -20
==========================================
+ Hits 1075 1090 +15
- Misses 92 95 +3
Partials 4 4
Continue to review full report at Codecov.
|
…embed # Conflicts: # src/components/Chat/ChatMessage.tsx # test/specs/components/Chat/ChatMessage-test.tsx
Add embed mode for FocusZone and new Chat behavior
Hi, this PR does the following:
renderComponent
andUIComponent
:FocusZoneMode.Embed
, in which case FocusZone is not wrapping the component in an additional<div>
, but instead uses the component directly inrender
. This is necessary for some components (e.g.,ChatMessage
) not to break generic styling etc.protected
this.focusZone
reference toUIComponent
available in components, so they can e.g., callthis.focusZone.focus()
.FocusZone
directly:onFocusNotification
with a regularonFocus
event callback to pass unit tests with embed.ref={this.setRef}
withthis.setRef(this)
incomponentDidMount
to support functional components, which is needed to pass unit tests with embed.defaultActiveElement
to query only descendants of the focus zone instead of the whole document, which enables to write simpler selectors. Note that we do not lose any functionality by this, because selecting elements outside of focus zone had no effect.isConformant
andhandlesAccessibility
now support embedded FocusZone.Chat
andChatMessage
:focus
forChat
, andpreventDefault
forChatMessage
.Chat
, embedded FocusZone forChatMessage
.<a>
links toChat
example in docsite so that we can easily test navigation there.