Tab is not working in Bootstrap 5

Created on 27 July 2023, about 1 year ago
Updated 15 April 2024, 6 months ago

Problem/Motivation

In Bootstrap5.0 it does not appear to work.

Steps to reproduce

Change the bootstrap version to 5 in bootstrap_library and click

Proposed resolution

https://www.drupal.org/files/issues/2023-07-27/3377313-3.patch pathch need to merge.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India aryashreep

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇮🇳India ravi kant Jaipur

    @aryashreep
    According to me, we can provide a dropdown of Bootstrap versions.
    <select><option>Bootstrap-3</option><option>Bootstrap-4</option><option>Bootstrap-5</option></select>
    A conditional statement written in module file on based key value of dropdown.

  • I've confirmed that the tabs can have both data-toggle and data-bs-toggle without issue. If there's a way to fix the multiple active tab problem without removing

  • , it should work with Bootstrap 3, 4, and 5. Unfortunately I haven't had luck figuring that out.
  • This patch should work with Bootstrap 3, 4, and 5. It might be too narrowly scoped - it removes the <li> tag if the name of the theme is "bootstrap5". Not sure if there's a way to make it recognize any theme using Bootstrap 5.

  • Status changed to Postponed 11 months ago
  • 🇺🇸United States mark_fullmer Tucson

    This patch should work with Bootstrap 3, 4, and 5. It might be too narrowly scoped - it removes the

  • tag if the name of the theme is "bootstrap5". Not sure if there's a way to make it recognize any theme using Bootstrap 5.
  • Yes, this would be too narrowly scoped as-is. The expectation of this module is that the Bootstrap framework may be implemented in any manner, not just through the Drupal theme "Bootstrap 5."

    As with the problem noted in 💬 Vertical tabs not working with bootstrap 3 -- help? RTBC , it appears that the differences between Bootstrap 3, 4, and 5 necessitate some level of conditional logic .

    I've therefore created Configuration option to set which version of Bootstrap is being used Fixed . Once that is completed, we can return to this issue and add conditional logic in the code to vary the rendering as needed to match the version of the Bootstrap framework being used.

    Setting status to "Postponed."

  • Agree with #11 and #14. A conditional tied to a Bootstrap version selector would be a good fix.

    Looking at #3 I confirmed that the data-bs-toggle data-toggle attributes can both be included without issue. However, I've been unable to find any way to get Bootstrap 3 and 4 working without the <li> wrapper, or any way to get Bootstrap 5 working without removing it.

  • Status changed to Active 8 months ago
  • 🇺🇸United States mmarler

    The 2.x branch has a bootstrap version selector to help add conditional logic to this issue. Changing the status to active.

  • Merge request !15#3377313: Tab is not working in Bootstrap 5 → (Merged) created by mmarler
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update 7 months ago
    1 pass
  • Status changed to Needs review 7 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update 7 months ago
    1 pass
  • 🇺🇸United States mmarler
  • 🇮🇳India ravi kant Jaipur

    ravi kant changed the visibility of the branch 2.x to hidden.

  • 🇮🇳India ravi kant Jaipur

    ravi kant changed the visibility of the branch 2.x to active.

  • 🇮🇳India ravi kant Jaipur

    I cannot checkout the MR branch.

  • 🇺🇸United States mark_fullmer Tucson

    I cannot checkout the MR branch.

    I think this is because the merge request branch was unconventionally named 2.x, matching the branch name from the origin. You can work around this by running the following:

    git remote add bootstrap_horizontal_tabs-3377313 git@git.drupal.org:issue/bootstrap_horizontal_tabs-3377313.git
    git fetch bootstrap_horizontal_tabs-3377313
    git pull bootstrap_horizontal_tabs-3377313 2.x

  • Status changed to Needs work 7 months ago
  • 🇺🇸United States mark_fullmer Tucson

    In testing this merge request, I realize that the change introduced to the 2.x branch in Configuration option to set which version of Bootstrap is being used Fixed makes a backwards-compatibility-breaking assumption: it sets the default version for Bootstrap library to "5," where up till now, this module has assumed that Bootstrap 3/4 is installed.

    We should not introduce this new assumption in a minor version release of this module (i.e., 2.x branch). We could make the new default for Bootstrap 5 in a new major version branch (3.x). But for now, this needs to be reworked so that new and existing sites, when they update to a 2.x release of this module with this code change, the default value is "4," not "5."

    Why this matters:
    1. An existing site that has up till now been assuming that this module, out of the box, works with Bootstrap 3 or 4, when updating, will have their integrations failing.
    2. For new sites based on distributions which package configurations of Bootstrap Horizontal Tabs, they would also 'not work' out of the box anymore.

    How this should be refactored:
    1. Set the default for new installs to '4' instead of '5' in config/install/bootstrap_horizontal_tabs.settings.yml
    2. Add an update hook for existing sites that populates bootstrap_horizontal_tabs.settings.version to '4'
    3. Refactor the #default value in src/Form/BaseConfigurationForm.php from '5' to '4'
    4. Create a new issue for a new major version branch of bootstrap_horizontal_tabs that sets the version to '5' instead of '4'.

  • Status changed to Needs review 7 months ago
  • 🇺🇸United States mmarler

    Ready for further review.

  • Status changed to RTBC 6 months ago
  • 🇺🇸United States mark_fullmer Tucson

    With the latest changes, this functionally checks out and won't adversely affect existing sites!

  • Pipeline finished with Skipped
    6 months ago
    #134877
    • mmarler committed 27961d92 on 2.x
      Issue #3377313 by mmarler, aryashreep, mukesh-kumar3, bjc2265,...
  • 🇺🇸United States mmarler
  • Status changed to Fixed 6 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Production build 0.71.5 2024