fix(VChip, VTab): render inner wrappers as phrasing content - #23106
Open
BatLeDev wants to merge 2 commits into
Open
fix(VChip, VTab): render inner wrappers as phrasing content#23106BatLeDev wants to merge 2 commits into
BatLeDev wants to merge 2 commits into
Conversation
VChip defaults its root tag to span, so everything it renders inside must be phrasing content. Four wrappers were hardcoded as div — v-chip__filter, v-chip__prepend, v-chip__content and v-chip__append — so every chip emitted a div inside a span, which the W3C validator rejects: Element "div" not allowed as child of element "span" in this context. Unlike the same defect on VBadge (vuetifyjs#23093), no particular nesting is needed to trigger this: a plain chip is invalid on its own, anywhere on the page. All four are now span, which is also what the sibling v-chip__overlay and v-chip__underlay wrappers already were. No visual change: VChip.sass declares display: inline-flex explicitly on .v-chip__content and on the .v-chip__filter/.v-chip__prepend/.v-chip__append group, so the tag name carries no layout meaning. The close button is untouched — it is a button element, valid phrasing content already. None of these wrappers is reachable from userland (tag only controls the root), so there was no workaround short of patching the package.
Same defect as VChip, one component further: VTab renders its underline as a hardcoded div.v-tab__slider inside VBtn's default slot, which VBtn wraps in a span.v-btn__content. Every tab therefore emits a div inside a span, which the W3C validator rejects: Element "div" not allowed as child of element "span" in this context. The slider is now a span. No visual change: .v-tab__slider is position: absolute, which blockifies the box whatever the tag name. The element is not reachable from userland — tag only controls the root of the underlying VBtn — so there was no workaround short of patching the package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fixes #23103
Two components render non-phrasing content inside a
span, producing the same W3C error:VChipdefaults its roottagtospan, so everything it renders inside must be phrasing content. Four wrappers were hardcoded asdiv—v-chip__filter,v-chip__prepend,v-chip__contentandv-chip__append— so every chip was invalid on its own, anywhere on the page. Unlike the same class of defect onVBadge(#23093), there is notagdefault to debate here, since the root is already aspan.All four are now
span, which is what the siblingv-chip__overlayandv-chip__underlaywrappers already were.VTabrenders its underline as a hardcodeddiv.v-tab__sliderinsideVBtn's default slot, whichVBtnwraps in aspan.v-btn__content— so every tab emits adivinside aspantoo. It is now aspan. Repro: https://vtfy.link/vtab-slider-invalid-nestingNo visual change in either case.
VChip.sassdeclaresdisplay: inline-flexexplicitly on.v-chip__contentand on the.v-chip__filter/.v-chip__prepend/.v-chip__appendgroup, and.v-tab__sliderisposition: absolute, which blockifies the box whatever the tag name.v-chip__filteris the only wrapper inside aVExpandXTransition; itsdisplayis declared the same way, and the added test covers it. The chip's close button is untouched — it is abuttonelement, already valid phrasing content.None of these elements is reachable from userland (
tagonly controls the root, and forVTabthe root of the underlyingVBtn), so there was no workaround short of patching the package.Added a test per component: the chip root is a
spanwhose subtree contains nodiv, with filter, prepend and append all rendered; and the tab'sv-btn__contentcontains the slider and nodiv.Happy to split this back into two PRs if you'd rather keep them separate.
Markup:
Run the rendered page through https://validator.w3.org/nu — one
div-inside-spanerror per chip and per tab before, none after.