-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: definition tooltip breaks with large text #17964
base: main
Are you sure you want to change the base?
Changes from all commits
73b1720
421aa33
43644fb
55dbdb0
181bc52
4ff1b5e
11d15da
67af4d6
4818a5e
3d0a020
b66392a
e530aa7
c30402a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -98,6 +98,11 @@ export interface PopoverBaseProps { | |||||
*/ | ||||||
align?: PopoverAlignment; | ||||||
|
||||||
/** | ||||||
* Will add padding value to arrow in case of bottom-left, bottom-right or top-left, top-right | ||||||
*/ | ||||||
arrowPadding?: number; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is minor, but the website docs exclusively refer to it as a caret and not an arrow. |
||||||
|
||||||
/** | ||||||
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes. | ||||||
*/ | ||||||
|
@@ -179,7 +184,7 @@ export const Popover: PopoverComponent = React.forwardRef( | |||||
highContrast = false, | ||||||
onRequestClose, | ||||||
open, | ||||||
alignmentAxisOffset, | ||||||
arrowPadding, | ||||||
...rest | ||||||
}: PopoverProps<E>, | ||||||
forwardRef: ForwardedRef<Element> | ||||||
|
@@ -267,14 +272,7 @@ export const Popover: PopoverComponent = React.forwardRef( | |||||
|
||||||
// Middleware order matters, arrow should be last | ||||||
middleware: [ | ||||||
offset( | ||||||
!isTabTip | ||||||
? { | ||||||
alignmentAxis: alignmentAxisOffset, | ||||||
mainAxis: popoverDimensions?.current?.offset, | ||||||
} | ||||||
: 0 | ||||||
), | ||||||
offset(!isTabTip ? popoverDimensions?.current?.offset : 0), | ||||||
autoAlign && | ||||||
flip({ | ||||||
fallbackPlacements: align.includes('bottom') | ||||||
|
@@ -313,6 +311,7 @@ export const Popover: PopoverComponent = React.forwardRef( | |||||
}), | ||||||
arrow({ | ||||||
element: caretRef, | ||||||
padding: arrowPadding, | ||||||
}), | ||||||
autoAlign && hide(), | ||||||
], | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,9 +225,9 @@ Toggletip.propTypes = { | |
]), | ||
|
||
/** | ||
* Provide an offset value for alignment axis. | ||
* Will add padding value to arrow in case of bottom-left, bottom-right or top-left, top-right | ||
*/ | ||
alignmentAxisOffset: PropTypes.number, | ||
arrowPadding: PropTypes.number, | ||
Comment on lines
+228
to
+230
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mirror the |
||
|
||
/** | ||
* Provide a custom element or component to render the top-level node for the | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,11 +50,14 @@ export const Default = (args) => { | |
<p> | ||
Custom domains direct requests for your apps in this Cloud Foundry | ||
organization to a{' '} | ||
<DefinitionTooltip openOnHover definition={definition} {...args}> | ||
URL | ||
<DefinitionTooltip | ||
openOnHover | ||
autoAlign | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using experimental props on default stories could be troublesome because devs use these as a snippet to copy/paste. A new |
||
definition={definition} | ||
{...args}> | ||
URL that you own. A custom domain can be a shared domain, | ||
</DefinitionTooltip>{' '} | ||
that you own. A custom domain can be a shared domain, a shared subdomain, | ||
or a shared domain and host. | ||
a shared subdomain, or a shared domain and host. | ||
</p> | ||
); | ||
}; | ||
|
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.
I think we should avoid specifying the deprecated alignment options. Keeping it experimental for now seems prudent, too. Maybe revising to something like this: