Skip to content

fix: wrapper element changing after first render #935

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

Merged
merged 3 commits into from
Feb 3, 2023

Conversation

danielbarion
Copy link
Member

@danielbarion danielbarion commented Feb 3, 2023

close #929

@@ -38,7 +38,7 @@ const Tooltip = ({
setIsOpen,
}: ITooltip) => {
const tooltipRef = useRef<HTMLElement>(null)
const tooltipArrowRef = useRef<HTMLDivElement>(null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to match other possible elements

@@ -19,7 +19,7 @@ const Tooltip = ({
events = ['hover'],
positionStrategy = 'absolute',
middlewares,
wrapper: WrapperElement = 'div',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value removed because there's no way to use Tooltip component directly without Controller and Controller always passes a wrapper to Tooltip

@@ -43,7 +43,7 @@ export interface ITooltip {
id?: string
variant?: VariantType
anchorId?: string
wrapper?: WrapperType
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible undefined removed because there's no way to use Tooltip component directly without Controller and Controller always passes a wrapper to Tooltip

@@ -85,7 +85,7 @@ const TooltipController = ({
setTooltipOffset(value === null ? offset : Number(value))
},
wrapper: (value) => {
setTooltipWrapper((value as WrapperType) ?? 'div')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix.

when the component start to check anchor attributes and there's no wrapper, the wrapper state gets updated to be a div

@danielbarion danielbarion merged commit 8af7a46 into master Feb 3, 2023
@danielbarion danielbarion deleted the fix/wrapper-behavior branch February 3, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT REQ] Customizable Arrow Wrapper
2 participants