Skip to content

[bug]: Sidebar component needs SheetTitle and SheetDescription #6686

Open
@castpy

Description

Describe the bug

See the error displayed if there are no components in the title:
Image

  1. Solution:

Add this code snippet to the Sidebar component

<SheetTitle className="hidden"></SheetTitle> {/*👈🏻 */}
<SheetDescription className="hidden"></SheetDescription> {/*👈🏻 */}

In the condition

if (isMobile) {
      return (
        <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
          <SheetTitle className="hidden"></SheetTitle> {/*👈🏻 */}
          <SheetDescription className="hidden"></SheetDescription> {/*👈🏻 */}
          <SheetContent
            data-sidebar="sidebar"
            data-mobile="true"
            className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
            style={
              {
                "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
              } as React.CSSProperties
            }
            side={side}
          >
            <div className="flex h-full w-full flex-col">{children}</div>
          </SheetContent>
        </Sheet>
      );
    }

Affected component/components

Sidebar

How to reproduce

  1. Do the standard structuring to display the sidebar
  2. Change the layout to mobile
  3. Click to display the sidebar

Codesandbox/StackBlitz link

No response

Logs

System Info

Chrome

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions