Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #38189
Closed
Open
Issue created Mar 07, 2023 by devhoussam1998@devhoussam19983 of 3 checklist items completed3/3 checklist items

Next.js (13.2.3) - bootstrap@5.3.0-alpha1: Uncaught TypeError: Cannot read properties of undefined (reading 'backdrop')

Prerequisites

  • I have searched for duplicate or closed issues
  • I have validated any HTML to avoid common problems
  • I have read the contributing guidelines

Describe the issue

I'm currently utilizing Next.js version 13.2.3 alongside bootstrap@5.3.0-alpha1. However, I am encountering an issue whereby attempting to close the offcanvas triggers an error message to appear on my development console:

alt text alt text

Here is how I setup bootstrap on my .tsx file:

'use client';

import { useEffect } from 'react';

export default function Script() {
  useEffect(() => {
    typeof document !== 'undefined' && require('bootstrap/dist/js/bootstrap');
  }, []);
  return null;
}

Please take note that the dropdown is functioning properly, therefore the issue is not related to how I configured bootstrap.

Reduced test cases

https://user-images.githubusercontent.com/121255432/223431257-1a4af3ab-ef3a-423c-8cc4-4f5edb4ffdf7.mov

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

bootstrap@5.3.0-alpha1

Assignee
Assign to
Time tracking