DEV Community

Cover image for 5 Things AI Can't Do, Even in Boostrap
DevUnionX
DevUnionX

Posted on

5 Things AI Can't Do, Even in Boostrap

Bootstrap has been making the idea of adding a few classes and standing up an interface practical for years. Thanks to its grid system with container, row, col; ready-made components like navbar, modal, dropdown, offcanvas; helper classes and theme infrastructure with Sass/CSS variables, it proves especially useful under time pressure. The official releases page lists the latest update for v5.x as v5.3.8. The blog post also positions this version as last patch before v5.4.0.

AI tools give the impression of being very powerful right here. They can rapidly produce working pages with Bootstrap, often remembering class names correctly. But making good products in the real world with Bootstrap isn't just writing correct classes. It means carrying together layers like semantic HTML, component JavaScript behavior, grid breakpoint edge cases, theme and brand loyalty, accessibility with WCAG plus ARIA, and scaled compatibility with build tools. Even the official Migrating to v5 documentation lists that v4 to v5 transition changes not just class names but dependencies like jQuery removal and Popper v2, data attribute names with data-bs prefix, navbar structure, and grid behavior.

This report shows five Bootstrap-specific areas where AI gets stuck at what we call even can't do. When we say can't, we mean AI cannot reliably produce results alone. Output it produces must be validated with human oversight, testing, and design decisions. This framework also aligns with field study general findings reporting that AI code assistants provide speed in real projects but struggle with complex tasks, multi-file context, and specific codebases.

In the following five sections, you'll find for each topic: technical background, AI's concrete failure modes, real case and issue examples, short code snippets with Turkish comments, and applicable mitigation strategies. Bootstrap appears easy because it actually offers a well-documented vocabulary: grid classes, component markup, helpers, utilities. Additionally, Bootstrap 5 increasingly using CSS variables, these variables being defined both at root level and component/utility level, making some customizations possible without recompilation gets emphasized on official site.

But the same documentation also says Bootstrap isn't a world of defaults. Optimization topics like modular usage with Sass, importing only needed parts, including only necessary plugins lean on JavaScript side, cleaning unused CSS, Autoprefixer and browserslist management get explained one by one on official Optimize page. What challenges AI in Bootstrap often is this: AI copies document examples while insufficiently seeing project's real conditions like which version, which bundler, which theme strategy, which a11y targets, which user base, which legacy browser matrix. Moreover, Bootstrap's recent direction including color modes, CSS variables, focus ring helpers requires working more like a design system.

The following visuals may help visually recall Bootstrap's most frequently used structures like grid, navbar, modal and theme approach with dark mode. Bootstrap components are a two-part model: HTML/CSS classes and optional JavaScript plugins for interactive components. Official JavaScript documentation explains these plugins can be used with data API and programmatic API, each component having its own behavior options. This model adds the semantic dimension too. Bootstrap's accessibility page notes interactive components like modal, dropdown, tooltip use WAI-ARIA roles and attributes for keyboard and screen reader users, while implying correct functioning relates to correct implementation and usage.

On customization side, Bootstrap's official approach proceeds from two main paths: using Sass sources and customizing at compile time with variables, maps and mixins, and making more limited but quick adjustments at runtime with CSS variables. Sass page and Customize/CSS variables pages detail these two ways. Though Bootstrap components appear copy-paste, AI's frequent mistakes are very familiar in practice.

Version mixing: Bootstrap 5 removed jQuery dependency, plugins got rewritten as regular JavaScript and data attributes got namespaced in data-bs asterisk form. But AI can still carry v4 alphabet like data-toggle equals modal and data-target equals hash id into v5 project. In this case HTML looks correct but component doesn't work. Breaking markup contract: for instance navbar now requires a container inside. Migration documentation explicitly notes this as breaking change. AI might skip this container and think it fixed things by adding some padding, but responsive behavior and spacing consistency break.

Forgetting JavaScript or loading it twice: Optimize page recommends lean JavaScript approach, using only as much JS as needed, while JavaScript documentation explains how to include plugins. AI most frequently falls into error at two extremes: either doesn't add JS at all so modal doesn't work, or loads both bundle and separate modules together causing collision. Example broken in my case syndrome: even in GitHub discussions, someone copying an example from Bootstrap site says it looks broken in my case and asks how to reproduce exactly. Such discussions generally come from bundle, CSS/JS inclusion order, example page needing additional stylesheet or JS.

Bootstrap's own migration documentation gives v4 to v5 transition scope in detail: jQuery removal, transition to Popper v2, data attribute names being data-bs, navbar container requirement, changes in grid and gutter system. Because of these changes, people looking for automatic upgrade tool exist, but even in community it's accepted this will remain limited. Tools exist that replace class names like bootstrap-5-migrate-tool, but these tools only catch class change part. Parts like JS behavior and accessibility remain human work. In enterprise world, even Microsoft Power Pages Bootstrap migration tool documentation explicitly writes steps like review changes and compare/adapt. Meaning even if tool does transformation, final word is in human.

The following example shows a simple modal triggering example with correct data attribute names in Bootstrap 5, especially making visible the point AI most frequently mistakes. In Bootstrap 5, not data-toggle but data-bs-toggle is used. Button type button with class btn btn-primary, data-bs-toggle modal, data-bs-target hash ornekModal. Opens Modal. Div class modal fade with id ornekModal, tabindex minus one, aria-labelledby ornekModalBaslik, aria-hidden true. Inside modal-dialog and modal-content, modal-header with h1 class modal-title fs-5 with id, button type button class btn-close with data-bs-dismiss modal and aria-label Close. Modal-body with content. The data-bs asterisk naming is a clearly noted breaking point in official migration documentation.

The way to speed process without reducing human oversight is fragmenting work instead of giving AI the complete thing. Pin version and write in prompt like using Bootstrap 5.3.8, data-bs asterisk mandatory. Version page gives current patch information. Per-component contract file: put modal/dropdown/offcanvas variants your team uses into a single design contract page. Compare AI output with this contract. Bootstrap's Approach and Customize pages explain how components are constructed. An internal standard derived from here works very well. Runnable examples with Storybook/Playground: copied but doesn't work problems mostly come from include order and missing assets. Official Quick start and Contents documentation explains which files and assets exist.

Don't think upgrade work is just class change. Migration documentation details change isn't just class but extends to JS, grid, navbars and dependencies. Bootstrap grid system works with container, row, col hierarchy, based on 12 column logic and supports six responsive breakpoints. Breakpoints take effect at that breakpoint and above with min-width media query logic. For instance .col-sm-4 is valid on sm and larger screens. Details appear small but determine actual user experience. Container varieties include .container, .container-fluid and breakpoint-dependent responsive containers like .container-md.

Gutters: control horizontal/vertical spacing with classes like g-asterisk, gx-asterisk, gy-asterisk. Additionally migration documentation notes gutters became rem-based in v5 and .no-gutters changed to .g-0. Column behavior: columns are on flexbox architecture. Content must be inside column. Documentation warns you can rarely merge content and column but unintended results may occur. Bootstrap 5.3 CSS variables documentation also says another nuance of grid: though breakpoints are defined as CSS variables, CSS variables don't work in media queries. This is a consequence of CSS specification. This information closes the tempting but wrong idea of changing breakpoint value at runtime from the start.

Grid is one of AI's most comfortable writing places until actual content and actual breakpoints enter the picture. Concrete failure modes: misunderstanding breakpoint logic. AI might think .col-sm-4 works only at sm and add new classes at upper breakpoints. But documentation is clear: affects that and above with min-width logic. Breaking hierarchy: using col without row breaks alignment due to negative margin and padding/gutter balance. Official grid documentation explains row is wrapper for columns. Gutter plus content overflow: especially on small screens, default gutters like g-3 plus long Turkish texts plus icons combine and buttons overflow. AI tries patching this with add one more class. But correct solution is sometimes text-truncate, sometimes different grid distribution at breakpoints, sometimes UX decisions like shortening text or removing icon.

Merging content and column error: the Columns documentation warning comes against what AI frequently does in practice. AI sometimes puts p directly inside div class row and gives col-asterisk on top. This produces surprise results especially in nested grids. CSS variable with breakpoint fantasy: AI might suggest using variables like bs-breakpoint-md inside media query. But Bootstrap's CSS variables page explicitly states CSS variables don't work in media queries. Bootstrap's migration documentation notes in grid updates section: new xxl breakpoint added, gutter system changed, and some order-asterisk classes reduced. This information makes simply carrying old example approach dangerous.

Another practical case: an important part of discussions starting with copied example exactly but broken actually comes from missing responsive meta tag. Official quick start writes step by step that meta name viewport tag is necessary for correct responsive behavior on mobile. AI sometimes forgets this line because the rest of HTML appears working, but on mobile everything scales and grid behaves strange. Short code example showing correct hierarchy: container to row to col. Div class container py-4. Inside div class row g-3. Inside multiple div class col-12 col-md-6 col-lg-4 with inner div class p-3 border rounded containing cards. How .col-md-6 and .col-lg-4 classes take effect at that breakpoint and above gets clearly explained in grid documentation.

Mitigation strategies: test breakpoints with content. Grid breaks with real text not lorem ipsum. Rules grid and breakpoints documentation explains should be validated with real content. Manage gutter not randomly but like design system. Gutters becoming rem-based in v5 and .g-asterisk system being standardized is for grid spacing equals spacing scale approach. Don't try using CSS variable in media query. Bootstrap's own CSS variables documentation clearly closes this trap. Catch AI output with layout testing. AI's mistake is generally not syntax but behavior. Starter examples in Bootstrap's Examples page help you set up quick testing in environments like Webpack/Vite.

Bootstrap 5.3's theme approach matured seriously. Color modes light/dark and custom modes can be applied both globally at html root and at specific components with data-bs-theme attribute. This now offers a systematic way instead of just CSS override for adding dark mode. Bootstrap also uses CSS variables more comprehensively. CSS variables page shows many bs-asterisk variables exist for runtime customization without compilation, base values get defined with selectors like root and data-bs-theme equals light. Component variables also get defined in local scope attempting to reduce inheritance errors.

On utility side, two main worlds exist: ready utility classes like .text-asterisk, .bg-asterisk, .m-asterisk, .p-asterisk, and Utility API managing utility generation/extension with Sass, using Sass maps and functions. This is powerful but attention-requiring infrastructure for brand loyalty. Reward is consistent design system. Cost is everywhere override and bloated CSS if not properly constructed. The fundamental reason AI produces apparently good but actually fragile output in Bootstrap: thinking defaults are brand language.

Concrete failure modes: thinking dark mode is black background. Color modes in Bootstrap 5.3 are opt-in and work with data-bs-theme. AI sometimes doesn't know this and suggests crude override like body background hash 000. This breaks component-level variables, contrast, and link colors. Overriding CSS variables in wrong place: CSS variables documentation explains some variables set at root, some on component class, and explicitly says setting at component base requires less guessing. But AI generally overrides everything at root. This can clash with local component variables.

Using breakpoint variables in media query fallacy: Bootstrap documentation closes this clearly saying CSS variables don't work in media query. AI still might produce suggestion saying manage breakpoint with variable. Thinking Utility API produces a couple classes: Utility API generates class families over Sass maps. If wrongly constructed, can generate thousands of classes bloating bundle. AI's biggest weakness here: cannot foresee CSS volume a small change produces and maintenance cost. Missing version-caused behavior changes: Bootstrap blog shows focus ring helpers came in 5.3.x versions, docs and CSS/JS bugfixes continue. If AI's training data is old, it might give solution saying it was this way in 5.2 and might not use 5.3.x's new mechanisms, especially CSS variables themed ones.

Official blog describes Bootstrap 5.3.0's detailed announcement of dark mode and custom color modes. Same post also emphasizes new accessibility-touching parts like focus ring helper. On the other hand, when you see questions in GitHub discussions like how should I change primary color with CSS variables loading Bootstrap from CDN, topic has gone beyond add a class level. People want to do even simplest customization with best method. This also makes AI's producing single answer harder, because correct method varies by project's distribution model, CDN or package manager plus Sass. Customize overview page explains this distinction directly as two preferred methods.

Short code examples showing Bootstrap 5.3 color mode usage. In html tag with lang tr, data-bs-theme dark applies color mode across entire page. The data-bs-theme approach gets explained in official color modes documentation. CSS variable with small override example: In root selector, overriding Bootstrap's root variables is practical for projects using CDN. Example: bringing interface background and font family closer to brand with bs-body-bg and bs-body-font-family. This approach aligns with runtime customize without recompile Sass idea explained in Bootstrap's CSS variables documentation.

Sass compile-time theme color change idea as concept example. Setting theme variables at Sass compile time is more comprehensive. Note: Bootstrap Sass documentation explains variables, maps, mixins. Example shows dollar sign primary color then at import bootstrap. Sass customization approach gets explained in official Sass documentation. Mitigation strategies: choose and pin theme strategy. CDN plus CSS variables or npm plus Sass? Customize overview puts two main paths as preferred methods. Manage color mode through data-bs-theme. This is the mechanism Bootstrap designed. Instead of painting dark color with override, you use entire component variable ecosystem.

Use Utility API controlled. Utility API generates class families with Sass maps. Instead of arbitrarily expanding, constrain like design system. Limit AI with token dictionary. Unless you tell AI use these variables, stay in this palette/spacing scale, it sticks to default Bootstrap aesthetics. CSS variables documentation explicitly lists which variables are at root. Embed this in prompt making allowed variable list. Bootstrap treats accessibility not as just CSS but as interactive component behavior. Official accessibility page says components like modal/dialog, dropdown, tooltip are designed for keyboard users and WAI-ARIA roles and attributes can be used.

But critical point is this: ARIA attributes alone don't do work. MDN Web Docs aria-modal documentation explicitly says aria-modal has no functional effect on page. Focus management and background interaction must be managed by JavaScript. This clarifies that accessibility in JS-based components like Bootstrap is correct markup plus correct JS behavior. WAI-ARIA Authoring Practices APG modal dialog pattern also says same direction: Tab/Shift plus Tab should keep focus from going outside dialog, focusing outside before dialog closes isn't targeted.

Bootstrap 5.3 bringing focus ring helpers and focus variables is also an important development touching this area. The .focus-ring helper removes default outline and offers customizable box-shadow-based indicator with CSS variables. AI's problem in accessibility isn't not knowing ARIA but cannot simulate correct context and actual user flow. Concrete failure modes: focus trap inconsistency. Bootstrap components like modal and offcanvas rely on disabling background idea. But in real life this has platform differences. For instance iOS VoiceOver with focus trap behaving unexpectedly, needing approaches like aria-hidden and inert gets discussed in Bootstrap issues. AI doesn't see this because it worked on desktop.

Focus errors visible even in Bootstrap's own documentation: there's an issue detecting difference in two different offcanvas focus trap behavior in Bootstrap docs. One correct, other reporting users can escape to underlying page with tab. This shows accessibility isn't the same everywhere. Implementation detail matters. ARIA attribute usage diverging from actual behavior: there's an issue criticized for offcanvas saying writes aria-modal equals true but focus isn't kept inside. This clearly shows the fallacy of wrote ARIA, done. One of AI's easiest traps to fall into.

Invisible but focusable content: Bootstrap 5.3.6 release notes have a fix preventing overflowing children inside .visually-hidden from accidentally becoming focusable. So accessibility is a subtle area continuously improved even in framework itself. AI's producing correct in one shot isn't realistic. Missing new WCAG criteria: WCAG 2.2 added new criteria like Target Size Minimum and Focus Not Obscured. Producing small icon button with Bootstrap classes is easy, but requirements like target size and focus visibility depend on design decisions. AI doesn't target this by default.

Bootstrap GitHub issues have been discussing modal accessibility for years: adopting aria-modal usage, iOS VoiceOver focus trap problems, aria-hidden warnings when modal closes. These discussions show not that framework isn't accessible but this reality: accessible components like modal and offcanvas are complex engineering problem in browser plus screen reader plus JS focus triple. APG also formalizes this complexity as pattern. Bootstrap 5.3's focus ring helper is a good tool for managing the trap of eliminating outline for aesthetics sake in accessibility more controlled.

Example code showing .focus-ring with more controllable focus indicator. Anchor tag with d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2 containing focus example. What .focus-ring helper does gets explained in official documentation. Another practical helper: .visually-hidden-focusable for visually hide but show when focused. Anchor class visually-hidden-focusable href hash anaIcerik containing skip to content. Main tag with id anaIcerik. This helper's behavior gets explained in official documentation.

Mitigation strategies: don't think ARIA is magical. Attributes like aria-modal are declaration. JavaScript does focus management. This warning is explicitly written in MDN. Take APG as reference. In patterns like modal dialog, validate decisions like Tab order, initial focus, and where focus returns when closing with APG. Embed WCAG 2.2 criteria in design. Focus visibility with Focus Appearance and target size with Target Size are now part of current expectations. Real device plus real screen reader test: focus trap problems on environments like iOS VoiceOver have been reported. Worked in Chrome isn't enough.

Follow Bootstrap release notes: even helpers like .visually-hidden can get accessibility fixes. This shows framework update isn't cosmetic. When you take Bootstrap from CDN linked level to enterprise design system level, actual problem isn't component HTML but distribution model. Official Optimize page addresses this directly. Titles like Lean Sass imports, lean JavaScript, unused CSS, minify/gzip, non-blocking files, Autoprefixer and browserslistrc show Bootstrap's not download big file but compile and shrink according to need perspective.

Bootstrap also offers official build tool guides for this. For instance Webpack guide explains how to bundle CSS/JS, production optimizations, and import only parts you need approach. JavaScript page also summarizes how to use plugins with data API or programmatically, which plugin needs what. On version and dependency side, v4 to v5 transition is serious lesson. Migration documentation writes jQuery removed, transitioned to Popper v2, Sass side took direction from Libsass to Dart Sass.

AI sees build chain as outside project. Meaning package.json, bundler config, tree-shaking behavior, CSS import order, CDN integrity, separate JS bundle or ESM module, these are context problems. Studies reporting AI code assistants struggle especially with multi-file, complex work in real projects quantitatively support this context blindness too. Bootstrap-specific concrete failure modes: choosing wrong distribution path. Customize overview makes package manager use sources versus compiled/CDN use distribution distinction as two preferred methods. But AI sometimes mixes these two. Says change Sass variable but project has no Sass pipeline, or produces practically meaningless suggestions like reduce JS with tree-shaking while using CDN.

Seemingly trivial version differences being breaking: Blog writes 5.3.7 contains small but impactful fixes around docs/JS/build tools, 5.3.8 did reversion for dropdown focus bug. AI says bootstrap caret greater than 5.3 and passes, but even a focus bug affects accessibility. Sass side deprecation and map requirements: Sass documentation says some deprecation warnings can be seen with Dart Sass and this doesn't prevent functioning. AI here might say there's error stop or suggests wrong fix. Additionally migration documentation notes breaking changes like now requiring all values be defined in Sass maps.

Forgetting to clean unused CSS: Optimize page explicitly addresses unused CSS topic. If you take all of Bootstrap but use only 3 components, performance and transfer cost emerges. AI mostly gives faster result with include everything, but this is wrong decision at scale. Bootstrap release notes can even include external dependency effects like Autoprefixer-caused regression, for example 5.3.5 hotfix. This shows build chain can break outside Bootstrap too. A risk AI generally doesn't account for.

On Turkish source side, posts describing Bootstrap 4 to 5 transition experience exist. For instance a Medium post summarizes removed features and breaking changes, explaining migration isn't just class change. Short code examples showing Bootstrap's take only what you need idea approaching Sass import skeleton as concept. In production most teams act selective instead of importing everything. This example is conceptual. Which files to import gets determined according to Bootstrap's docs/optimize and Sass structure. Import functions, variables, mixins. Add only component you need like buttons, forms, modal.

Bootstrap emphasizes modular customization with Sass and lean Sass imports approach on Optimize page. JavaScript lean usage idea with documentation-aligned approach. If using interactive component, include JS correctly. Script source bootstrap.bundle.min.js. JavaScript documentation explains plugins are optional and how to use them. Mitigation strategies: choose distribution strategy from start. CDN or source Sass? Customize overview explicitly presents this distinction saying best path depends on your project.

Make optimize guide checklist. Lean Sass imports, Unused CSS, Minify/gzip, these aren't we'll look later but should be determined as target at least from first sprint. Pin version and read release notes. Fixes like 5.3.8's dropdown focus bug reversion directly touch a11y and UX. Lean on official guides for build tools. Official example projects like Webpack guide are more reliable starting point than AI's general web rule talk.

The following table prepares to summarize difference between AI-generated Bootstrap output and human-designed Bootstrap output like design system. Not absolute correct numbers but framework for thinking quality dimensions. This distinction aligns with field study general findings reporting AI code assistants provide speed in real projects but struggle in complex contexts. Comparing dimension, AI-generated Bootstrap output typical, and human-designed Bootstrap output. Correctness: frequently visually correct but fragile in details like version, data attribute, JS inclusion. Deterministic according to version and component contract, migration and optimize decisions conscious.

Accessibility: mechanically adds ARIA but can miss focus management and real screen reader behavior. Gets tested with APG and WCAG targets, criteria like focus trap, focus visibility, target size in process. Maintainability: sticking to default aesthetics, place-by-place override and scattered theme approach. Theme and token strategy clear with CSS vars or Sass, utility API controlled, single language in project. Bundle size: tendency to include everything for convenience, unused CSS/JS cleanup can be forgotten. Selective import with optimize checklist, lean JS, minify/gzip and unused CSS strategy exists.

Brand loyalty: treating dark mode like black paint, overriding CSS vars in wrong places. Consistent brand language with data-bs-theme plus CSS variables or Sass, component variables in correct scope. The developer plus AI workflow and decision points diagram shows clarifying project reality including Bootstrap version, distribution model, a11y targets. Then contracts about component markup rules plus theme/token approach. Then draft generation with AI for page/component skeleton.

Decision point about version compatibility check with data-bs-asterisk, no jQuery, Popper v2. If no, fix according to migration documentation plus rebuild examples. If yes, decision whether component works with JS included, correct ID/target, unique instance. If no, align with official component docs plus validate with minimal example. If yes, grid breakpoint tests with real content plus different breakpoints. If fail, fix container/row/col and gutter design plus responsive meta tag check. If pass, a11y tests with APG plus WCAG 2.2 critical points.

If fail, focus management, focus visibility, target size plus real device/screen reader test. If pass, optimize with lean Sass imports, lean JS, unused CSS. If fail, shrink according to official optimize guide plus measure bundle. If pass, code review plus visual regression plus release notes tracking. The following sources carry weight in this report as official/standard/primary reference summary list. Bootstrap versions page with current patch. Bootstrap Blog 5.3.8 about dropdown focus bug reversion and patch strategy. Bootstrap Migrating to v5 about jQuery removal, data-bs-asterisk, navbar/gutter changes. Bootstrap Grid, Breakpoints, Columns documentation about responsive logic and hierarchy warnings.

Bootstrap CSS variables and Color modes documentation about theme and data-bs-theme. Bootstrap Accessibility documentation about component a11y target. WAI-ARIA APG Modal dialog pattern about focus management principles. WCAG 2.2 plus Understanding pages about Focus Appearance and Target Size. MDN aria-modal about ARIA alone not doing work and focus managed with JS. AI code assistant field research about struggling in complex/multi-file context.

Top comments (0)