-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1455 +/- ##
=========================================
- Coverage 73.63% 73.44% -0.2%
=========================================
Files 808 818 +10
Lines 6092 6179 +87
Branches 1774 1774
=========================================
+ Hits 4486 4538 +52
- Misses 1601 1636 +35
Partials 5 5
Continue to review full report at Codecov.
|
@mnajdova thanks for starting on this!! There are just a couple things I noticed..
|
Similarly to reakit tooltip or Fabric, we will need to have a reference between the tooltip between the tooltip and trigger, most probably using aria-describedby. When rendered it should look something like this:
Let's discuss how the API should look like, I would propose to make the We can later (out of this PR) have some helper hook:
And for the actionable components:
which would automatically render the Tooltip and Button with appropriate pros |
@jurokapsiar if the id is necessary, we can make it in required and hoist it in the Tooltip component. Then in the behavior we can specify this prop as I see the tooltipBehavior as something like this:
|
@codepretty answers to your points
Currently the beak is implemented exactlly as it is in the Popup. Are these two different? Let's align them both in a separate PR for red-lining the component, as this is base implementation
I was thinking the same, but as in the Popup this prop was by default false, I added that as a default. I will change this to be true by default in the Tooltip. If people are agains this, we can export the Tooltip on the client's side to have this to be true by default
Let me try to remove this option in the alignment of the Tooltip, I agree is not something typical for the Tooltip.
Would rather wait for designs for something like that before adding examples in the docs, but yes if there are use cases like this, would be happy to add more examples
NO! Very valid point, will remove that example :) |
we did some testing on our prototypes and it looks like we will need to change the approach: the div containing tooltip text will always need to be present in the DOM and the trigger elements will need to point to it using aria-describedby. focus/hover should then only change the visibility. let's discuss offline how this can be achieved. Regarding your response - yes, it can work, if we are ok with modifying the trigger. |
-addressed other PR comments
# Conflicts: # CHANGELOG.md # packages/react/src/lib/positioner/Popper.tsx # packages/react/src/lib/positioner/types.ts
packages/react/src/themes/teams-high-contrast/components/Tooltip/tooltipContentVariables.ts
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Tooltip/Types/TooltipExamplePointing.tsx
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Tooltip/Types/TooltipExamplePointing.shorthand.tsx
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Tooltip/Types/TooltipExample.shorthand.steps.ts
Outdated
Show resolved
Hide resolved
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.
👍 great job!
@@ -127,7 +127,15 @@ const Popper: React.FunctionComponent<PopperProps> = props => { | |||
popperRef.current = createPopper(targetRef.current, contentRef.current, options) | |||
}, | |||
// TODO review dependencies for popperHasScrollableParent |
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 comment still necessary - I mean, if these are reviewed, we may remove TODO
comment :) or there are some checks that you still expect to be made?
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.
Not sure, this was here before. I found this issue while working on the tooltip, so I added the triggerRef there as well. I think is @Bugaa92 's call about whether it is safe to remove it
import { useBooleanKnob } from '@stardust-ui/docs-components' | ||
|
||
const TooltipOpenExample = () => { | ||
const [open, setOpen] = useBooleanKnob({ name: 'open-c', initialValue: true }) |
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.
const [open, setOpen] = useBooleanKnob({ name: 'open-c', initialValue: true }) | |
const [open, setOpen] = useBooleanKnob({ name: 'open', initialValue: true }) |
After #1489 will be merged
import { useBooleanKnob } from '@stardust-ui/docs-components' | ||
|
||
const TooltipOpenExample = () => { | ||
const [open, setOpen] = useBooleanKnob({ name: 'open-c', initialValue: true }) |
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.
const [open, setOpen] = useBooleanKnob({ name: 'open-c', initialValue: true }) | |
const [open, setOpen] = useBooleanKnob({ name: 'open', initialValue: true }) |
After #1489 will be merged
|
||
const TooltipExamplePosition = () => { | ||
const [positionAndAlign] = useSelectKnob({ | ||
name: 'position-align-c', |
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.
name: 'position-align-c', | |
name: 'position-align', |
After #1489 will be merged
|
||
const TooltipExamplePosition = () => { | ||
const [positionAndAlign] = useSelectKnob({ | ||
name: 'position-align-s', |
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.
name: 'position-align-s', | |
name: 'position-align', |
After #1489 will be merged
Fix #1453 - add Tooltip component.
A tooltip displays information related to an element when the element receives keyboard focus, or the mouse hovers over it. The Tooltip component has the following API:
Common Stardust props
accessibility
styles
variables
className
content
- the content that will appear inside the tooltipchildren
Custom component props
target
- the element to which the tooltip is associated withmouseLeaveDelay
- delay in ms for the mouse leave event, before the tooltip will be closed.pointing
- whether the tooltip should show pointer towards the targetalign
- alignment for the tooltip. Can have one of the following values:'top' | 'bottom' | 'start' | 'end' | 'center'
mountNode
- Existing element the tooltip should be bound to.position
- has one of the following value:'above' | 'below' | 'before' | 'after'
. It has higher priority than align. If position is vertical ('above' | 'below'
) and align is also vertical ('top' | 'bottom'
) or if both position and align are horizontal ('before' | 'after' and 'start' | 'end'
respectively), then provided value for 'align' will be ignored and'center'
will be used instead.With this API the component will be similar to the Popup component, and it will be easy for the users to learn the new component's API.
TODO: