Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
{
"path": "./dist/css/bootstrap.css",
"maxSize": "25.25 kB"
"maxSize": "25.5 kB"
},
{
"path": "./dist/css/bootstrap.min.css",
"maxSize": "23.25 kB"
"maxSize": "23.5 kB"
},
{
"path": "./dist/js/bootstrap.bundle.js",
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"object-curly-newline": ["error", { "minProperties": 1 }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": "error",
"one-var": ["error", "never"],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: 'echo "gem: --no-document" > ~/.gemrc'

- name: Set up Ruby cache
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-v${{ matrix.ruby }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('Gemfile.lock') }}
Expand All @@ -41,7 +41,7 @@ jobs:
${{ runner.os }}-ruby-v${{ matrix.ruby }}-

- name: Set up npm cache
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

group :development, :test do
gem 'jekyll', '~> 4.0.1'
gem 'jekyll', '~> 4.1.0'
gem 'jekyll-redirect-from', '~> 0.16.0'
gem 'jekyll-sitemap', '~> 1.4.0'
gem 'jekyll-toc', '~> 0.14.0'
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ GEM
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
eventmachine (1.2.7-x64-mingw32)
ffi (1.12.2)
ffi (1.12.2-x64-mingw32)
ffi (1.13.0)
ffi (1.13.0-x64-mingw32)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
jekyll (4.0.1)
jekyll (4.1.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (>= 0.9.5, < 2)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3.3)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
Expand All @@ -50,7 +50,7 @@ GEM
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mercenary (0.4.0)
mini_portile2 (2.4.0)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
Expand All @@ -63,11 +63,11 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.18.0)
rouge (3.19.0)
safe_yaml (1.0.5)
sassc (2.3.0)
sassc (2.4.0)
ffi (~> 1.9)
sassc (2.3.0-x64-mingw32)
sassc (2.4.0-x64-mingw32)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
Expand All @@ -79,7 +79,7 @@ PLATFORMS
x64-mingw32

DEPENDENCIES
jekyll (~> 4.0.1)
jekyll (~> 4.1.0)
jekyll-redirect-from (~> 0.16.0)
jekyll-sitemap (~> 1.4.0)
jekyll-toc (~> 0.14.0)
Expand Down
13 changes: 0 additions & 13 deletions build/babel-helpers.js

This file was deleted.

15 changes: 7 additions & 8 deletions build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

'use strict'

const path = require('path')
const rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const banner = require('./banner.js')
const babelHelpers = require('./babel-helpers.js')
const path = require('path')
const rollup = require('rollup')
const { babel } = require('@rollup/plugin-babel')
const banner = require('./banner.js')

const TEST = process.env.NODE_ENV === 'test'
const TEST = process.env.NODE_ENV === 'test'
const plugins = [
babel({
// Only transpile our source code
exclude: 'node_modules/**',
// Include only required helpers
externalHelpersWhitelist: babelHelpers
// Inline the required helpers in each file
babelHelpers: 'inline'
})
]
const bsPlugins = {
Expand Down
17 changes: 8 additions & 9 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
'use strict'

const path = require('path')
const babel = require('rollup-plugin-babel')
const path = require('path')
const { babel } = require('@rollup/plugin-babel')
const resolve = require('@rollup/plugin-node-resolve')
const banner = require('./banner.js')
const babelHelpers = require('./babel-helpers.js')
const banner = require('./banner.js')

const BUNDLE = process.env.BUNDLE === 'true'
const BUNDLE = process.env.BUNDLE === 'true'

let fileDest = 'bootstrap.js'
let fileDest = 'bootstrap.js'
const external = ['jquery', 'popper.js']
const plugins = [
babel({
// Only transpile our source code
// Only transpile our source code
exclude: 'node_modules/**',
// Include only required helpers
externalHelpersWhitelist: babelHelpers
// Include the helpers in the bundle, at most one copy of each
babelHelpers: 'bundled'
})
]
const globals = {
Expand Down
2 changes: 2 additions & 0 deletions js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class Modal {
this._element.style.display = 'block'
this._element.removeAttribute('aria-hidden')
this._element.setAttribute('aria-modal', true)
this._element.setAttribute('role', 'dialog')

if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
modalBody.scrollTop = 0
Expand Down Expand Up @@ -344,6 +345,7 @@ class Modal {
this._element.style.display = 'none'
this._element.setAttribute('aria-hidden', true)
this._element.removeAttribute('aria-modal')
this._element.removeAttribute('role')
this._isTransitioning = false
this._showBackdrop(() => {
$(document.body).removeClass(CLASS_NAME_OPEN)
Expand Down
5 changes: 3 additions & 2 deletions js/tests/integration/rollup.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const resolve = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const babel = require('rollup-plugin-babel')
const { babel } = require('@rollup/plugin-babel')

module.exports = {
input: 'js/tests/integration/bundle.js',
Expand All @@ -14,7 +14,8 @@ module.exports = {
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
exclude: 'node_modules/**',
babelHelpers: 'bundled'
})
]
}
17 changes: 17 additions & 0 deletions js/tests/unit/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,23 @@ $(function () {
.bootstrapModal('show')
})

QUnit.test('should add role="dialog" attribute when shown, remove it again when hidden', function (assert) {
assert.expect(3)
var done = assert.async()

$('<div id="modal-test"/>')
.on('shown.bs.modal', function () {
assert.ok($('#modal-test').is('[role]'), 'role attribute added')
assert.strictEqual($('#modal-test').attr('role'), 'dialog', 'correct role="dialog" added')
$(this).bootstrapModal('hide')
})
.on('hidden.bs.modal', function () {
assert.notOk($('#modal-test').is('[role]'), 'role attribute removed')
done()
})
.bootstrapModal('show')
})

QUnit.test('should close reopened modal with [data-dismiss="modal"] click', function (assert) {
assert.expect(2)
var done = assert.async()
Expand Down
14 changes: 7 additions & 7 deletions js/tests/visual/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
<div class="container mt-3">
<h1>Modal <small>Bootstrap Visual Test</small></h1>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
Expand Down Expand Up @@ -121,14 +121,14 @@ <h4>Overflowing text to show scroll behavior</h4>
</div>
</div>

<div class="modal fade" id="firefoxModal" tabindex="-1" role="dialog" aria-labelledby="firefoxModalLabel" aria-hidden="true">
<div class="modal fade" id="firefoxModal" tabindex="-1" aria-labelledby="firefoxModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="firefoxModalLabel">Firefox Bug Test</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="firefoxModalLabel">Firefox Bug Test</h4>
</div>
<div class="modal-body">
<ol>
Expand All @@ -147,14 +147,14 @@ <h4 class="modal-title" id="firefoxModalLabel">Firefox Bug Test</h4>
</div>
</div>

<div class="modal fade" id="slowModal" tabindex="-1" role="dialog" aria-labelledby="slowModalLabel" aria-hidden="true" style="transition-duration: 5s;">
<div class="modal fade" id="slowModal" tabindex="-1" aria-labelledby="slowModalLabel" aria-hidden="true" style="transition-duration: 5s;">
<div class="modal-dialog" style="transition-duration: inherit;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>
</div>
<div class="modal-body">
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Nulla vitae elit libero, a pharetra augue.</p>
Expand Down Expand Up @@ -194,7 +194,7 @@ <h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>
Tall body content to force the page to have a scrollbar.
</div>

<button type="button" class="btn btn-secondary btn-lg" data-toggle="modal" data-target="&#x3C;div class=&#x22;modal fade the-bad&#x22; tabindex=&#x22;-1&#x22; role=&#x22;dialog&#x22;&#x3E;&#x3C;div class=&#x22;modal-dialog&#x22; role=&#x22;document&#x22;&#x3E;&#x3C;div class=&#x22;modal-content&#x22;&#x3E;&#x3C;div class=&#x22;modal-header&#x22;&#x3E;&#x3C;button type=&#x22;button&#x22; class=&#x22;close&#x22; data-dismiss=&#x22;modal&#x22; aria-label=&#x22;Close&#x22;&#x3E;&#x3C;span aria-hidden=&#x22;true&#x22;&#x3E;&#x26;times;&#x3C;/span&#x3E;&#x3C;/button&#x3E;&#x3C;h4 class=&#x22;modal-title&#x22;&#x3E;The Bad Modal&#x3C;/h4&#x3E;&#x3C;/div&#x3E;&#x3C;div class=&#x22;modal-body&#x22;&#x3E;This modal&#x27;s HTTML source code is declared inline, inside the data-target attribute of it&#x27;s show-button&#x3C;/div&#x3E;&#x3C;/div&#x3E;&#x3C;/div&#x3E;&#x3C;/div&#x3E;">
<button type="button" class="btn btn-secondary btn-lg" data-toggle="modal" data-target="&#x3C;div class=&#x22;modal fade the-bad&#x22; tabindex=&#x22;-1&#x22;&#x3E;&#x3C;div class=&#x22;modal-dialog&#x22;&#x3E;&#x3C;div class=&#x22;modal-content&#x22;&#x3E;&#x3C;div class=&#x22;modal-header&#x22;&#x3E;&#x3C;button type=&#x22;button&#x22; class=&#x22;close&#x22; data-dismiss=&#x22;modal&#x22; aria-label=&#x22;Close&#x22;&#x3E;&#x3C;span aria-hidden=&#x22;true&#x22;&#x3E;&#x26;times;&#x3C;/span&#x3E;&#x3C;/button&#x3E;&#x3C;h4 class=&#x22;modal-title&#x22;&#x3E;The Bad Modal&#x3C;/h4&#x3E;&#x3C;/div&#x3E;&#x3C;div class=&#x22;modal-body&#x22;&#x3E;This modal&#x27;s HTTML source code is declared inline, inside the data-target attribute of it&#x27;s show-button&#x3C;/div&#x3E;&#x3C;/div&#x3E;&#x3C;/div&#x3E;&#x3C;/div&#x3E;">
Modal with an XSS inside the data-target
</button>

Expand Down
Loading