Skip to content

Commit

Permalink
Merge branch 'main' into patrickhlauke-issue36506
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhlauke committed Jul 30, 2022
2 parents 7cec833 + 8553030 commit e8b8dd6
Show file tree
Hide file tree
Showing 39 changed files with 202 additions and 110 deletions.
4 changes: 1 addition & 3 deletions .github/CONTRIBUTING.md
Expand Up @@ -18,9 +18,7 @@ the preferred channel for [bug reports](#bug-reports), [features requests](#feat
and [submitting pull requests](#pull-requests), but please respect the following
restrictions:

* Please **do not** use the issue tracker for personal support requests. Stack
Overflow ([`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5) tag),
[Slack](https://bootstrap-slack.herokuapp.com/) or [IRC](/README.md#community) are better places to get help.
* Please **do not** use the issue tracker for personal support requests. Stack Overflow ([`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5) tag), [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions) or [IRC](/README.md#community) are better places to get help.

* Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
Expand Down
2 changes: 1 addition & 1 deletion .github/SUPPORT.md
Expand Up @@ -6,6 +6,6 @@ See the [contributing guidelines](CONTRIBUTING.md) for sharing bug reports.

For general troubleshooting or help getting started:

- Join [the official Slack room](https://bootstrap-slack.herokuapp.com/).
- Ask and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions).
- Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel.
- Ask and explore Stack Overflow with the [`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5) tag.
5 changes: 2 additions & 3 deletions README.md
Expand Up @@ -58,7 +58,6 @@ Read the [Getting started page](https://getbootstrap.com/docs/5.2/getting-starte

## Status

[![Slack](https://bootstrap-slack.herokuapp.com/badge.svg)](https://bootstrap-slack.herokuapp.com/)
[![Build Status](https://img.shields.io/github/workflow/status/twbs/bootstrap/JS%20Tests/main?label=JS%20Tests&logo=github)](https://github.com/twbs/bootstrap/actions?query=workflow%3AJS+Tests+branch%3Amain)
[![npm version](https://img.shields.io/npm/v/bootstrap)](https://www.npmjs.com/package/bootstrap)
[![Gem version](https://img.shields.io/gem/v/bootstrap)](https://rubygems.org/gems/bootstrap)
Expand Down Expand Up @@ -138,7 +137,7 @@ We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified

## Bugs and feature requests

Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/main/.github/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new).
Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/main/.github/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new/choose).


## Documentation
Expand Down Expand Up @@ -178,7 +177,7 @@ Get updates on Bootstrap's development and chat with the project maintainers and

- Follow [@getbootstrap on Twitter](https://twitter.com/getbootstrap).
- Read and subscribe to [The Official Bootstrap Blog](https://blog.getbootstrap.com/).
- Join [the official Slack room](https://bootstrap-slack.herokuapp.com/).
- Ask and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions).
- Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel.
- Implementation help may be found at Stack Overflow (tagged [`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5)).
- Developers should use the keyword `bootstrap` on packages which modify or add to the functionality of Bootstrap when distributing through [npm](https://www.npmjs.com/browse/keyword/bootstrap) or similar delivery mechanisms for maximum discoverability.
Expand Down
6 changes: 2 additions & 4 deletions config.yml
Expand Up @@ -48,10 +48,9 @@ module:
target: static/favicon.ico

params:
description: "The most popular HTML, CSS, and JS library in the world."
subtitle: "The most popular HTML, CSS, and JS library in the world."
description: "Powerful, extensible, and feature-packed frontend toolkit. Build and customize with Sass, utilize prebuilt grid system and components, and bring projects to life with powerful JavaScript plugins."
authors: "Mark Otto, Jacob Thornton, and Bootstrap contributors"
social_image_path: /docs/5.2/assets/brand/bootstrap-social.png
social_logo_path: /docs/5.2/assets/brand/bootstrap-social-logo.png

current_version: "5.2.0"
current_ruby_version: "5.2.0"
Expand All @@ -60,7 +59,6 @@ params:
github_org: "https://github.com/twbs"
repo: "https://github.com/twbs/bootstrap"
twitter: "getbootstrap"
slack: "https://bootstrap-slack.herokuapp.com/"
opencollective: "https://opencollective.com/bootstrap"
blog: "https://blog.getbootstrap.com/"
themes: "https://themes.getbootstrap.com/"
Expand Down
22 changes: 13 additions & 9 deletions js/src/scrollspy.js
Expand Up @@ -40,14 +40,16 @@ const Default = {
offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: '0px 0px -25%',
smoothScroll: false,
target: null
target: null,
threshold: [0.1, 0.5, 1]
}

const DefaultType = {
offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: 'string',
smoothScroll: 'boolean',
target: 'element'
target: 'element',
threshold: 'array'
}

/**
Expand Down Expand Up @@ -110,6 +112,13 @@ class ScrollSpy extends BaseComponent {
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
config.target = getElement(config.target) || document.body

// TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin

if (typeof config.threshold === 'string') {
config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value))
}

return config
}

Expand Down Expand Up @@ -141,8 +150,8 @@ class ScrollSpy extends BaseComponent {
_getNewObserver() {
const options = {
root: this._rootElement,
threshold: [0.1, 0.5, 1],
rootMargin: this._getRootMargin()
threshold: this._config.threshold,
rootMargin: this._config.rootMargin
}

return new IntersectionObserver(entries => this._observerCallback(entries), options)
Expand Down Expand Up @@ -187,11 +196,6 @@ class ScrollSpy extends BaseComponent {
}
}

// TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
_getRootMargin() {
return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin
}

_initializeTargetsAndObservables() {
this._targetLinks = new Map()
this._observableSections = new Map()
Expand Down
4 changes: 4 additions & 0 deletions js/src/tooltip.js
Expand Up @@ -185,6 +185,10 @@ class Tooltip extends BaseComponent {
this.tip.remove()
}

if (this._config.originalTitle) {
this._element.setAttribute('title', this._config.originalTitle)
}

this._disposePopper()
super.dispose()
}
Expand Down
44 changes: 44 additions & 0 deletions js/tests/unit/scrollspy.spec.js
Expand Up @@ -126,6 +126,50 @@ describe('ScrollSpy', () => {
expect(scrollSpy._rootElement).toBeNull()
})

it('should respect threshold option', () => {
fixtureEl.innerHTML = [
'<ul id="navigation" class="navbar">',
' <a class="nav-link active" id="one-link" href="#">One</a>' +
'</ul>',
'<div id="content">',
' <div id="one-link">test</div>',
'</div>'
].join('')

const scrollSpy = new ScrollSpy('#content', {
target: '#navigation',
threshold: [1]
})

expect(scrollSpy._observer.thresholds).toEqual([1])
})

it('should respect threshold option markup', () => {
fixtureEl.innerHTML = [
'<ul id="navigation" class="navbar">',
' <a class="nav-link active" id="one-link" href="#">One</a>' +
'</ul>',
'<div id="content" data-bs-threshold="0,0.2,1">',
' <div id="one-link">test</div>',
'</div>'
].join('')

const scrollSpy = new ScrollSpy('#content', {
target: '#navigation'
})

// See https://stackoverflow.com/a/45592926
const expectToBeCloseToArray = (actual, expected) => {
expect(actual.length).toBe(expected.length)
for (const x of actual) {
const i = actual.indexOf(x)
expect(x).withContext(`[${i}]`).toBeCloseTo(expected[i])
}
}

expectToBeCloseToArray(scrollSpy._observer.thresholds, [0, 0.2, 1])
})

it('should not take count to not visible sections', () => {
fixtureEl.innerHTML = [
'<nav id="navigation" class="navbar">',
Expand Down
19 changes: 19 additions & 0 deletions js/tests/unit/tooltip.spec.js
Expand Up @@ -419,6 +419,25 @@ describe('Tooltip', () => {
tooltip.show()
})
})

it('should destroy a tooltip and reset it\'s initial title', () => {
fixtureEl.innerHTML = [
'<span id="tooltipWithTitle" rel="tooltip" title="tooltipTitle"></span>',
'<span id="tooltipWithoutTitle" rel="tooltip" data-bs-title="tooltipTitle"></span>'
].join('')

const tooltipWithTitleEl = fixtureEl.querySelector('#tooltipWithTitle')
const tooltip = new Tooltip('#tooltipWithTitle')
expect(tooltipWithTitleEl.getAttribute('title')).toBeNull()
tooltip.dispose()
expect(tooltipWithTitleEl.getAttribute('title')).toBe('tooltipTitle')

const tooltipWithoutTitleEl = fixtureEl.querySelector('#tooltipWithoutTitle')
const tooltip2 = new Tooltip('#tooltipWithTitle')
expect(tooltipWithoutTitleEl.getAttribute('title')).toBeNull()
tooltip2.dispose()
expect(tooltipWithoutTitleEl.getAttribute('title')).toBeNull()
})
})

describe('show', () => {
Expand Down
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -136,15 +136,15 @@
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"karma-rollup-preprocessor": "7.0.7",
"lockfile-lint": "^4.7.6",
"lockfile-lint": "^4.7.7",
"nodemon": "^2.0.19",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.14",
"postcss-cli": "^10.0.0",
"rollup": "^2.77.0",
"rollup-plugin-istanbul": "^3.0.0",
"rtlcss": "^3.5.0",
"sass": "^1.53.0",
"sass": "^1.54.0",
"shelljs": "^0.8.5",
"stylelint": "^14.9.1",
"stylelint-config-twbs-bootstrap": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scss/_pagination.scss
Expand Up @@ -75,7 +75,7 @@
margin-left: $pagination-margin-start;
}

@if $pagination-margin-start == (calc($pagination-border-width * -1)) {
@if $pagination-margin-start == ($pagination-border-width * -1) {
&:first-child {
.page-link {
@include border-start-radius(var(--#{$prefix}pagination-border-radius));
Expand Down
2 changes: 1 addition & 1 deletion scss/_variables.scss
Expand Up @@ -1333,7 +1333,7 @@ $popover-box-shadow: $box-shadow !default;

$popover-header-font-size: $font-size-base !default;
$popover-header-bg: shade-color($popover-bg, 6%) !default;
$popover-header-color: var(--#{$prefix}heading-color) !default;
$popover-header-color: $headings-color !default;
$popover-header-padding-y: .5rem !default;
$popover-header-padding-x: $spacer !default;

Expand Down
2 changes: 1 addition & 1 deletion scss/mixins/_utilities.scss
Expand Up @@ -28,7 +28,7 @@

$infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);

// Don't prefix if value key is null (eg. with shadow class)
// Don't prefix if value key is null (e.g. with shadow class)
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");

@if map-get($utility, rfs) {
Expand Down
6 changes: 6 additions & 0 deletions site/assets/scss/_navbar.scss
Expand Up @@ -4,6 +4,12 @@
background-image: linear-gradient(to bottom, rgba(var(--bd-violet-rgb), 1), rgba(var(--bd-violet-rgb), .95));
box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15), inset 0 -1px 0 rgba(0, 0, 0, .15);

.bd-navbar-toggle {
@include media-breakpoint-down(lg) {
width: 4.25rem;
}
}

.navbar-toggler {
padding: 0;
margin-right: -.5rem;
Expand Down

0 comments on commit e8b8dd6

Please sign in to comment.