Skip to content

Fix openapi CR preview #3197

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/giant-dolphins-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@gitbook/react-openapi': patch
'gitbook': patch
---

Fix openapi CR preview
Original file line number Diff line number Diff line change
Expand Up @@ -688,18 +688,18 @@ body:has(.openapi-select-popover) {
}

.openapi-disclosure-group-trigger {
@apply flex w-full items-baseline gap-3 transition-all relative flex-1 p-3 -outline-offset-1;
@apply flex w-full cursor-pointer items-baseline gap-3 transition-all relative flex-1 p-3 -outline-offset-1;
}

.openapi-disclosure-group-label {
@apply flex flex-wrap items-baseline gap-x-3 gap-y-1 flex-1 truncate;
}

.openapi-disclosure-group-trigger:disabled {
.openapi-disclosure-group-trigger[aria-disabled="true"] {
@apply cursor-default hover:bg-inherit;
}

.openapi-disclosure-group-trigger:disabled .openapi-disclosure-group-icon {
.openapi-disclosure-group-trigger[aria-disabled="true"] .openapi-disclosure-group-icon {
@apply invisible;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/react-openapi/src/OpenAPIDisclosureGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function DisclosureItem(props: {
});

const panelRef = useRef<HTMLDivElement | null>(null);
const triggerRef = useRef<HTMLButtonElement | null>(null);
const triggerRef = useRef<HTMLDivElement | null>(null);
const isDisabled = groupState?.isDisabled || !group.tabs?.length || false;
const { buttonProps: triggerProps, panelProps } = useDisclosure(
{
Expand All @@ -96,11 +96,11 @@ function DisclosureItem(props: {

return (
<div className="openapi-disclosure-group" aria-expanded={state.isExpanded}>
<button
<div
slot="trigger"
ref={triggerRef}
{...mergeProps(buttonProps, focusProps)}
disabled={isDisabled}
aria-disabled={isDisabled}
style={{
outline: isFocusVisible
? '2px solid rgb(var(--primary-color-500)/0.4)'
Expand Down Expand Up @@ -146,7 +146,7 @@ function DisclosureItem(props: {
</div>
) : null}
</div>
</button>
</div>

{state.isExpanded && selectedTab && (
<div className="openapi-disclosure-group-panel" ref={panelRef} {...panelProps}>
Expand Down