0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Commit Graph

724 Commits

Author SHA1 Message Date
GeoSot
a9d7a62658
Use the backdrop util in offcanvas, enforcing consistency (#33545)
* respect /share modal's backdrop functionality, keeping consistency
* listen click events over backdrop (only) and trigger `hide()` without add/remove event tricks
* achieve to hide foreign open offcanvas instances without glitches `if (allReadyOpen && allReadyOpen !== target)`, in case another is going to be open, when user clicks on trigger button
2021-04-19 08:20:25 +03:00
GeoSot
6ea4dab142
modal.js: fix test for scrollbar (#33666)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-18 20:55:22 -07:00
Carson Sievert
69f5c0130b
Fix v5 regressions in tab dropdown functionality (#33626)
Scope selector to `dropdownElement` when adding active classes
2021-04-15 13:53:55 +03:00
GeoSot
80085a12f6
Decouple BackDrop from modal (#32439)
* Create backdrop.js util

* revert breaking changes

remove PromiseTimout usage

revert class name

* one more test | change bundlewatch.config

* add config obj to backdrop helper | tests for rootElement | use transitionend helper

* Minor tweaks — Renaming

Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-04-14 13:28:50 -07:00
GeoSot
0d440b0e14 Js: fix some tests 2021-04-14 13:25:44 -07:00
alpadev
db32b2380c
fix: make EventHandler better handle mouseenter/mouseleave events (#33310)
* fix: make EventHandler better handle mouseenter/mouseleave events

* refactor: simplify custom events regex and move it to a variable
2021-04-13 06:25:58 +03:00
Rohit Sharma
bac0b0c899 Update tests to check for noop to be removed 2021-04-11 09:42:52 +03:00
Rohit Sharma
b2bc159d72 Use cached noop function everywhere 2021-04-11 09:42:52 +03:00
GeoSot
7b7f4a5ced
Decouple Modal's scrollbar functionality (#33245) 2021-04-11 09:37:59 +03:00
Rohit Sharma
9bca1b5a8b
Remove unnecessary data-bs-backdrop="static" (#33578)
Since the value for the `backdrop` option is available in the configuration object.
2021-04-08 08:20:21 +03:00
GeoSot
0795a778f2
Fix wrong carousel transformation, direction to order (#33499) 2021-04-07 08:29:31 +03:00
GeoSot
752b001b0a Simplify Modal config 2021-04-06 18:43:43 +03:00
GeoSot
0b34ff2fae
Simplify ScrollSpy config (#33250) 2021-04-06 18:28:10 +03:00
Rohit Sharma
20cfbdff79
Add missing things in hide method of dropdown (#33451)
* Update `aria-expanded` attribute in `hide` method

* Remove empty mouseover listeners added for iOS
2021-04-01 21:51:55 +03:00
alpadev
f36f834453
Fix dropdown escape propagation (#33479) 2021-04-01 21:44:04 +03:00
Casey Holzer
16bc47da3c Allow data-toggle="dropdown" and form click events to bubble
* remove stopPropagation from button click event

* test for delegated click events

* ensure button children can open menu

* test to ensure clicking button opens the menu

* check current element and parents

* allow dropdown form click events to bubble
2021-03-23 15:56:28 +02:00
GeoSot
1c02ef4f97
Allow offcanvas to be initialized in open state (#33382)
* Update docs to use new .show behavior and clarify some copy for first example

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-23 08:22:59 +02:00
Rohit Sharma
72ef1dfdbd
Update unit tests for Popper V2 (#32662) 2021-03-17 21:25:57 +02:00
Patrick H. Lauke
3ce0a8d3ec
Dynamic tab should not show when triggered on disabled element (#33257)
* show() should bail if the trigger has `disabled` attribute

* use 'isDisabled' helper

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 10:52:40 +02:00
GeoSot
b9f30903a5
Fix carousel RTL and refactor code, fix rtl swipe issues (#32913)
* move common code to reusable functions

* add/re-factor tests, directionToOrder func

* add _orderToDirection tests

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 07:58:43 +02:00
GeoSot
c5083d5fc3
Use more safe check for 'isDisabled' helper (#33385) 2021-03-17 07:44:15 +02:00
GeoSot
ddf72bc612
Accept data-bs-body option in the configuration object as well (#33248)
* Accept data-bs-body option in the configuration object as well

Tweak jqueryInterface, add some more tests

* Fix Markdown table formatting and tweak the wording on backdrop

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-16 18:35:03 +02:00
Ryan Berliner
99b2c0b390 only trigger tooltip inserted event on true dom insert 2021-03-16 07:48:50 +02:00
Ryan Berliner
6ef70b342c prevent quick interactions from misplacing tooltips 2021-03-16 07:48:50 +02:00
Ryan Berliner
d491c29aa0 prevent tooltip from being deleted on quick re-activations 2021-03-16 07:48:50 +02:00
Rohit Sharma
6ecd1c626e
Change the name of the Offcanvas constructor (#33261) 2021-03-16 07:21:04 +02:00
GeoSot
548be2ed66
Offcanvas as component (#29017)
* Add a new offcanvas component

* offcanvas.js: switch to string constants and `event.key`

* Remove unneeded code

* Sass optimizations

* Fixes

Make sure the element is hidden and not offscreen when inactive
fix close icon negative margins
Add content in right & bottom examples
Re-fix bottom offcanvas height not to cover all viewport

* Wording tweaks

* update tests and offcanvas class

* separate scrollbar functionality and use it in offcanvas

* Update .bundlewatch.config.json

* fix focus

* update btn-close / fix focus on close

* add aria-modal and role
return focus on trigger when offcanvas is closed
change body scrolling timings

* move common code to reusable functions

* add aria-labelledby

* Replace lorem ipsum text

* fix focus when offcanvas is closed

* updates

* revert modal, add tests for scrollbar

* show backdrop by default

* Update offcanvas.md

* Update offcanvas CSS to better match modals

- Add background-clip for borders
- Move from outline to border (less clever, more consistent)
- Add scss-docs in vars

* Revamp offcanvas docs

- Add static example to show and explain the components
- Split live examples and rename them
- Simplify example content
- Expand docs notes elsewhere
- Add sass docs

* Add .offcanvas-title instead of .modal-title

* Rename offcanvas example to offcanvas-navbar to reflect it's purpose

* labelledby references title and not header

* Add default shadow to offcanvas

* enable offcanvas-body to fill all the remaining wrapper area

* Be more descriptive, on Accessibility area

* remove redundant classes

* ensure in case of an already open offcanvas, not to open another one

* bring back backdrop|scroll combinations

* bring back toggling class

* refactor scrollbar method, plus tests

* add check if element is not full-width, according to #30621

* revert all in modal

* use documentElement innerWidth

* Rename classes to -start and -end

Also copyedit some docs wording

* omit some things on scrollbar

* PASS BrowserStack tests

-- IOS devices, Android devices and Browsers on Mac, hide scrollbar by default and appear it, only while scrolling.

* Rename '_handleClosing' to '_addEventListeners'

* change pipe usage to comma

* change Data.getData to Data.get

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-03-02 19:10:10 +02:00
alpadev
48a95f7280
refactor: use a Map instead of an Object in dom/data (#32180)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-03-02 16:55:44 +02:00
Muhammadamin
056216a3bd
modal: don't add margin & padding when sticky is not full width (#30621)
* modal: don't add margin & padding when sticky is not full width

* Check if element is shorter than window

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-23 14:52:09 +02:00
Rohit Sharma
dc5e3328c1
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <otto@github.com>
2021-02-22 09:01:04 +02:00
Patrick H. Lauke
5693f1ad86
Fix small typos / follow-up to #32630 (#33164) 2021-02-21 08:00:03 +02:00
Nikon the Third
e8f08d1802
Adjust regex SAFE_URL_PATTERN for use with test method of regexes. (#33136)
The test method on regexes behaves different than the match method on strings in the presence of the global modifier.
Add a unit test for sanitizing the same template twice.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-19 10:24:53 +02:00
GeoSot
3602828a90
Add tests for DATA_KEY (#33090)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-16 08:58:08 +02:00
Rohit Sharma
6b6db4fd8a
Add the missing expectations for touch events (#33060) 2021-02-12 08:36:20 +02:00
Kyle Tsang
02dbd87ffa
Fix event handler removal in dropdown/carousel dispose (#33000)
* Fix event handler removal in carousel dispose

* Fix event handler removal in dropdown dispose

* Test event handlers in scrollspy dispose

* Test event handlers in toast dispose

* Test event handlers in tooltip dispose

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-12 07:51:34 +02:00
Rohit Sharma
f7088e5d28
Add function type for popperConfig option (#32882)
* Add function type for `popperConfig` option

* Update .bundlewatch.config.json

* copy edits

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-02-09 21:16:13 +02:00
Mark Otto
8f1c882545 Remove .dropdown-menu[style] reset and adjust .dropdown-menu-* modifiers
- Removes the &[style] selector that was used for resetting Popper styles
- Separate Popper-based alignment from static alignment with `data-bs-popover` attribute that separates the --bs-position and custom right/left properties

Co-Authored-By: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-09 14:34:27 +02:00
Patrick H. Lauke
96be06e32b
Dynamic tabs: use buttons rather than links (#32630)
* Dynamic tabs: use buttons rather than links

- change docs
- add mention that tabs should be <button> elements
- tweak styles to neutralise border and background

* Update js unit and visual test accordingly

- replace links with buttons
- make one specific test that uses links instead of buttons, as we still want to support it despite it being non-semantically appropriate
- Leaving a couple of tests for now. The test for removed tabs should be redone so that tabs are removed programmatically (as the approach of having that close button inside the link is invalid and broken markup). The test for dropdowns should be removed together we actually ripping out the handling for dropdowns in the tab.js code (arguably a breaking change, though we discouraged this for a few versions and effectively "deprecated" it)

* Add isolation:isolate to prevent focus being overlapped

https://github.com/twbs/bootstrap/pull/32630#issuecomment-756015766
2021-02-09 07:23:45 +02:00
Siju Samson
b376a3d80d
Fix dropdown keys to open menu (#32750)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 22:03:21 +02:00
Florian Vick
2a9d72133d
Prevent getSelector from returning URLs as selector (#32586)
* added checks to getSelector in util to prevent returning hrefs that are invalid selectors

* restored compatibility for the class selector and added test cases for keeping urls from being returned as a selector

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:58:54 +02:00
Rohit Sharma
3770b7b9e3
Dropdown — Emit events on the .dropdown-toggle button (#32625)
* Emit events on the dropdown button

Emit the events on `.dropdown-toggle` button and then bubble up

* Add migration note for events

* Update the docs for events

* Add unit test to check the event bubbling

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:51:19 +02:00
Patrick H. Lauke
a882614c45 Make carousel indicators actual buttons 2021-01-28 23:32:24 +02:00
Rohit Sharma
b1bd54955e Restore offset option for tooltip/popover components 2021-01-28 12:23:33 +02:00
joke2k
881f43a3b9 Restore offset option for dropdown component 2021-01-28 12:23:33 +02:00
XhmikosR
a56bf1de9f
Minor ESLint rules cleanup (#32904) 2021-01-28 11:34:20 +02:00
Patrick H. Lauke
3aa3fda730
Carousel: use buttons, not links, for prev/next controls (#32627)
* Carousel: use buttons, not links, for prev/next

- expand the styles to neutralise border/background
- change docs page
- add extra unit test to check that links or buttons work as controls
- modify visual test to use buttons as well
- use buttons instead of links for prev/next
- remove `role="button"` from links that are actually links

* Clarify that controls can be button or link

* Update site/content/docs/5.0/components/carousel.md

Co-authored-by: Mark Otto <markd.otto@gmail.com>

* Explicitly set padding to 0 to prevent dipping/moving on active in Firefox

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-27 17:31:16 +02:00
Rohit Sharma
c9cd741aff
Throw a TypeError instead of the generic Error (#32585)
* Change from Error to TypeError

* Convert the `NAME` to upper case to make the consistency in the error message

* Update the remaining tests to be stricter

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 22:13:30 +02:00
Rohit Sharma
e34481b6eb
Fix toggling modal when clicking on data-bs-toggle="modal" (#32691)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 21:59:47 +02:00
Théophile Helleboid - chtitux
80557b3ac0
Move "active" class from .nav-item to .nav-link (#32730) 2021-01-08 20:53:04 +02:00
Daniele Faraglia
59cd71631e
collapse: prevent url change if A nested tag is clicked (#32438)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:37:35 +02:00
Nils K
2d46e47464
Support Popper virtual elements (#32376)
Adds the ability to use objects implementing the virtual element interface as the value for the reference option of a dropdown config.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:32:11 +02:00
Gaël Poupard
58ab1c2cd5
test(carousel): french word in the wild (#32528) 2020-12-18 17:22:16 +02:00
Rohit Sharma
f12657b39f
tests: replace deprecated jQuery method (#32309)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-16 17:21:43 +02:00
Rohit Sharma
ebce95dc60
Tooltip - Add missing callback in async spec (#32465) 2020-12-14 13:02:34 +02:00
Rohit Sharma
4535b09c46
Tooltip - check if tip and its parent node exist in dispose method (#32420) 2020-12-10 21:06:41 +02:00
alpadev
85208ae557
Refactor components to use a utility function to define jQuery plugins (#32285)
* refactor: use an utility function to define jQuery plugins

* test: add spec for defineJQueryPlugin utility function

* Update .bundlewatch.config.json

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-08 08:16:50 +02:00
XhmikosR
d15a0247ce
Remove SelectorEngine.matches(). (#32339)
It's basically unused.
2020-12-07 19:10:20 +02:00
Johann-S
adfdf7160b Update to popper.js v2.x 2020-12-06 18:42:40 +02:00
Gaël Poupard
9488978fb5 feat(RTL): implement RTL
Using RTLCSS directives, renaming things to use logical names and following best practices.
2020-12-04 07:52:03 +02:00
XhmikosR
dd992c7226 Add tests 2020-11-30 12:07:51 +02:00
XhmikosR
51a208f119 Switch to Jasmine's toBeInstanceOf matcher 2020-11-29 20:58:26 +02:00
Johann-S
9f6b342dc7 create a base component 2020-11-29 20:58:26 +02:00
Rohit Sharma
c348ad4a94
Ability to add custom class in tooltip/popover (#32217)
Porting of #31834 to main.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-25 09:16:22 +02:00
XhmikosR
f4457bca02
Be consistent with Popper's name. (#32224)
The npm package is named "popper.js" but the project is named "Popper", so use the latter consistently.
2020-11-21 16:22:08 +02:00
Rohit Sharma
358c36d4b5
Add missing tags in unit tests (#32221) 2020-11-20 20:10:15 +02:00
Rohit Sharma
0839cbf04d
Don't hide modal when keyboard is set to false in modal's configuration (#32179)
* Don't hide modal when config.keyboard is false

* Update unit test

- Modal should not be closed when pressing esc key if keyboard = false
  and backdrop is 'static'

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 15:36:24 +02:00
Rohit Sharma
2630b05eb3
Make the attribute methods bs specific (#32173)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 11:13:13 +02:00
XhmikosR
2e758f64cf Switch to Number properties 2020-11-14 15:54:50 +02:00
XhmikosR
4f8b243ac1
Fix .close instances (#32152) 2020-11-14 08:16:30 +02:00
Rohit Sharma
e530118117 Get only bs prefixed data attributes 2020-11-14 07:09:15 +02:00
Rohit Sharma
418f17ee2b Add bs in data attributes
- Add `bs` in data APIs everywhere
- Update unit tests
2020-11-14 07:09:15 +02:00
XhmikosR
c9f8fa45fb
tests: tweak Jasmine usage (#32046)
* jasmine/expect-matcher
* jasmine/prefer-jasmine-matcher

Found with `eslint-plugin-jasmine`
2020-11-02 16:13:24 +02:00
XhmikosR
e2697b0573
tests: fix sanitizer test. (#32045)
The test template does not include a `script` tag so the test always returned true.
2020-11-02 14:49:56 +02:00
XhmikosR
71010cb1e9
tests: switch to using toContain() to check for substring presence (#32043) 2020-11-02 14:42:40 +02:00
Sascha
c21506d499
Fix TypeError when Bootstrap is included in head (#32024)
* extend jquery after domContentLoaded event is fired

* add unittest for util onDOMContentLoaded

* wait for trigger jquery event after domContentLoaded

* remove domcontentready from eventHandler

* move istanbul ignore statements to correct line

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-01 15:32:36 +02:00
Mitchell Bryson
3a5f9f5cf0
Check for data-interval on the first slide of carousel (#31818)
* check for data-interval on the first slide of carousel

* add updateInterval method for elements of a carousel

* add test for carousel interval being set during cycle

* update activeElement as soon as slide has finished (before transition end)

* only updateInterval before using it

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-01 14:36:50 +02:00
XhmikosR
b63066d630
toast.spec.js: fix typo (#32026) 2020-10-31 09:25:33 +02:00
XhmikosR
0c1651ee9d
Remove Manipulator.toggleClass (#31842)
It's only used in one place so it makes more sense to remove it for the time being.
2020-10-05 18:07:49 +03:00
Hiws
43b4252a34
fix tooltip hide method when already hidden (#31115)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-09-24 14:55:38 +03:00
Rohit Sharma
f6348f6c89
Clear timeout before showing the toast (#31155)
* clear timeout before showing the toast

* Add unit test

* Remove the check for timeout

* Check for clearTimeout to have been called

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-07-11 11:51:04 -07:00
Shohei Yoshida
fb4efb49ea
Prevent overflowing static backdrop modal animation (#30326)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-06-25 11:35:53 +03:00
Patrick H. Lauke
edbcc401c2
Change whitelist to allowlist (#31066)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markd.otto@gmail.com>
2020-06-19 11:31:37 +03:00
Tanguy Krotoff
d80a9fc553
Fix tooltip when hovering a children element (delegateTarget) (#30928)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-06-18 10:02:44 +03:00
Johann-S
088c727a31 data: reword storage key in dom 2020-06-17 15:45:36 +02:00
Martijn Cuppens
1a0a0858ef Remove checkbox/radio toggle from button plugin in favor of a CSS only solution 2020-06-15 19:04:19 -07:00
Rohit Sharma
e140ff92ed Remove .nav-item from .nav-link to make it consistent
- Closes #28423
2020-06-09 07:48:58 +03:00
Rohit Sharma
5faf41eb48
Add role="dialog" in modals via JavaScript (#30936) 2020-06-04 10:35:09 +03:00
Dominik Kremer
d59de33fc0 Add a test about the scrollbar issue on non-integer width 2020-05-12 07:51:09 +03:00
XhmikosR
94109cabf4
Add missing closing div tags (#30775)
Missed those in 967e607
2020-05-11 16:54:56 +03:00
XhmikosR
967e6071ba
tests: streamline HTML end tags (#30648) 2020-05-06 09:20:08 +03:00
Johann-S
650a7a7b76 add unit tests to ensure our plugins works in jquery 2020-05-06 07:55:48 +02:00
XhmikosR
37f2c04c5f
Clean up lint rules (#30721)
* Remove unneeded rule suppression
* Format tests/unit/.eslintrc.json
* build/.eslintrc.json: add strict for consistency
2020-05-04 19:32:09 +03:00
Tanguy Krotoff
d2ed920b15
Remove caret element (#30633) 2020-04-24 21:53:31 +02:00
Tanguy Krotoff
7787f642b9 Fix crash when pressing ArrowUp the first time 2020-04-17 18:22:15 +03:00
Tanguy Krotoff
dcd99aa7d1 Replace event.which with event.key and event.button 2020-04-17 18:22:15 +03:00
ysds
dfa017adc3 Always modal scroll top to 0 2020-04-01 10:05:43 +03:00
XhmikosR
e1f5d819c7
Remove MSPointerEvent and ms-touch-action in tests (#30463) 2020-03-29 09:59:54 +03:00
XhmikosR
ed94976ea8
Use textContent instead of innerText. (#30462)
It's supported by all of our supported browsers.
2020-03-29 09:53:57 +03:00
Laussel Loïc
7ce29d75f3
v5 tabs - accessibility issue when using ul/li semantic
Add aria-role presentation on li element when ul element has role tablist and remove dropdown from visual tests as they've been removed from doc
2020-03-28 09:51:24 +02:00
Johann-S
26d86fce2a
fix: remove make array util function (#30430) 2020-03-25 16:35:02 +02:00