🌐 AI搜索 & 代理 主页
Skip to content

Commit c48eb76

Browse files
authored
chore: minor tweaks for bootstrap v4.4 (#4440)
1 parent 0b89794 commit c48eb76

File tree

9 files changed

+21
-35
lines changed

9 files changed

+21
-35
lines changed

docs/components/anchored-heading.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default {
2626
return h(
2727
`h${props.level}`,
2828
mergeData(data, {
29+
staticClass: 'bv-no-focus-ring',
2930
attrs: {
3031
id: props.id,
3132
tabindex: '-1'

docs/components/section-toc.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<Main>
33
<Section>
4-
<h1 :id="id" tabindex="-1">
4+
<h1 :id="id" class="bv-no-focus-ring" tabindex="-1">
55
<span class="bd-content-title">
66
{{ groupTitle }} <span class="small text-muted">- table of contents</span>
77
</span>

docs/markdown/intro/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
- [Vue.js](https://vuejs.org/) `v{{ vueVersionMinor }}` is required, `v{{ vueVersion }}` is
77
recommended
8-
- [Bootstrap](https://getbootstrap.com/) `v{{ bootstrapVersionMinor }}` is required,
8+
- [Bootstrap](https://getbootstrap.com/) `4.3.1` is required,
99
`v{{ bootstrapVersion }}` is recommended
1010
- [PortalVue](https://portal-vue.linusb.org/) `v{{ portalVueVersionMinor }}` is required by
1111
[Toasts](/docs/components/toast), `v{{ portalVueVersion }}` is recommended

docs/nuxt.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ renderer.heading = function(text, level, raw, slugger) {
8888
ANCHOR_LINK_HEADING_LEVELS.indexOf(level) !== -1
8989
? `<a class="anchorjs-link" href="#${link}" aria-label="Anchor"></a>`
9090
: ''
91-
92-
return `<h${level} id="${link}">${getTextMarkup(text + anchor)}</h${level}>\n`
91+
const attrs = `id="${link}" class="bv-no-focus-ring"`
92+
return `<h${level} ${attrs}>${getTextMarkup(text + anchor)}</h${level}>\n`
9393
}
9494

9595
// Convert lead-in blockquote paragraphs to true bootstrap docs leads

docs/utils/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ export const makeTOC = (readme, meta = null) => {
8585
let parentIdx = 0
8686

8787
// Get the first <h1> tag with ID
88-
const h1 = readme.match(/<h1 id=([^> ]+)>(.+?)<\/h1>/) || []
88+
const h1 = readme.match(/<h1 id=([^> ]+)[^>]*>(.+?)<\/h1>/) || []
8989
if (h1) {
9090
top = `#${stripQuotes(h1[1])}`
9191
title = stripHTML(h1[2])
9292
}
9393

9494
// Get all the <h2> and <h3> headings with ID's
95-
const headings = readme.match(/<h([23]) id=[^> ]+>.+?<\/h\1>/g) || []
95+
const headings = readme.match(/<h([23]) id=[^> ]+[^>]*>.+?<\/h\1>/g) || []
9696

9797
// Process the <h2> and <h3> headings into a TOC structure
9898
headings
9999
// Create a match `[value, tag, id, content]`
100-
.map(heading => heading.match(/^<(h[23]) id=([^> ]+)>(.+?)<\/\1>$/))
100+
.map(heading => heading.match(/^<(h[23]) id=([^> ]+)[^>]*>(.+?)<\/\1>$/))
101101
// Filter out un-matched values
102102
.filter(v => Array.isArray(v))
103103
// Create TOC structure

src/_utilities.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ $bv-utility-classes-defined: false !default;
66
@if $bv-utility-classes-defined == false {
77
$bv-utility-classes-defined: true;
88

9+
// No focus outline helper (use sparingly)
10+
.bv-no-focus-ring:focus {
11+
outline: none;
12+
}
13+
914
// Create `.bv-d-<bp>-down-none` helper classes
1015
@each $breakpoint in map-keys($grid-breakpoints) {
1116
@include media-breakpoint-down($breakpoint) {

src/components/dropdown/_dropdown.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ $bv-dropdown-defined: false !default;
2525
}
2626
}
2727

28+
// Hide the focus ring introduced by Bootstratp v4.4 reboot
29+
// on items with tabindex="-1", as we know how users feel
30+
// about blue rings where they don't expect them.
31+
.dropdown-menu:focus {
32+
outline: none
33+
}
34+
2835
// Prevent dropdown background overflow if there's no padding
2936
// See https://github.com/twbs/bootstrap/pull/27703
3037
// Added here to address <li> wrapping of items

src/components/tabs/tab.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ export const BTab = /*#__PURE__*/ Vue.extend({
99
mixins: [idMixin, normalizeSlotMixin],
1010
inject: {
1111
bvTabs: {
12-
default() {
13-
return {
14-
// Don't set a tab index if not rendered inside <b-tabs>
15-
noKeyNav: true
16-
}
17-
}
12+
default: () => ({})
1813
}
1914
},
2015
props: {
@@ -181,7 +176,6 @@ export const BTab = /*#__PURE__*/ Vue.extend({
181176
attrs: {
182177
role: 'tabpanel',
183178
id: this.safeId(),
184-
tabindex: this.localActive && !this.bvTabs.noKeyNav ? '-1' : null,
185179
'aria-hidden': this.localActive ? 'false' : 'true',
186180
'aria-labelledby': this.controlledBy || null
187181
}

src/components/tabs/tab.spec.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,6 @@ describe('tab', () => {
178178
wrapper.destroy()
179179
})
180180

181-
it('has attribute tabindex="-1" when parent has keynav enabled and active', async () => {
182-
const wrapper = mount(BTab, {
183-
provide() {
184-
return {
185-
bvTabs: {
186-
fade: false,
187-
lazy: false,
188-
card: false,
189-
noKeyNav: false
190-
}
191-
}
192-
},
193-
propsData: { active: true }
194-
})
195-
196-
expect(wrapper.attributes('tabindex')).toBeDefined()
197-
expect(wrapper.attributes('tabindex')).toBe('-1')
198-
199-
wrapper.destroy()
200-
})
201-
202181
it("calls parent's updateButton() when title slot provided", async () => {
203182
let called = false
204183
let vm = null

0 commit comments

Comments
 (0)