mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-17 03:21:51 -05:00
fix: replace button with div in IdBadge to prevent hydration issues (backport) (#6602)
This commit is contained in:
committed by
GitHub
parent
0eddeb46c1
commit
4112722a88
@@ -59,8 +59,8 @@ export const BadgeContent: React.FC<BadgeContentProps> = ({
|
||||
};
|
||||
|
||||
const content = (
|
||||
<button
|
||||
type="button"
|
||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/prefer-tag-over-role, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
||||
<div
|
||||
role={isCopyEnabled ? "button" : undefined}
|
||||
className={getButtonClasses()}
|
||||
onClick={handleCopy}
|
||||
@@ -69,7 +69,7 @@ export const BadgeContent: React.FC<BadgeContentProps> = ({
|
||||
onMouseLeave={isCopyEnabled ? () => setIsHovered(false) : undefined}>
|
||||
<span>{id}</span>
|
||||
{renderIcon()}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
const getTooltipContent = () => {
|
||||
|
||||
@@ -96,7 +96,7 @@ describe("IdBadge", () => {
|
||||
test("removes interactive elements when copy is disabled", () => {
|
||||
const { container } = render(<IdBadge id="1734" copyDisabled={true} />);
|
||||
|
||||
const badge = container.querySelector("button");
|
||||
const badge = container.querySelector("div");
|
||||
|
||||
// Should not have cursor-pointer class
|
||||
expect(badge).not.toHaveClass("cursor-pointer");
|
||||
|
||||
Reference in New Issue
Block a user