Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename .active to .show #21036

Merged
merged 2 commits into from
Dec 20, 2016
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
6 changes: 3 additions & 3 deletions docs/components/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ Using the alert JavaScript plugin, it's possible to dismiss any alert inline. He
- Be sure you've loaded the alert plugin, or the compiled Bootstrap JavaScript.
- Add a dismiss button and the `.alert-dismissible` class, which adds extra padding to the right of the alert and positions the `.close` button.
- On the dismiss button, add the `data-dismiss="alert"` attribute, which triggers the JavaScript functionality. Be sure to use the `<button>` element with it for proper behavior across all devices.
- To animate alerts when dismissing them, be sure to add the `.fade` and `.active` classes.
- To animate alerts when dismissing them, be sure to add the `.fade` and `.show` classes.

You can see this in action with a live demo:

{% example html %}
<div class="alert alert-warning alert-dismissible fade active" role="alert">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
Expand Down Expand Up @@ -111,7 +111,7 @@ Note that closing an alert will remove it from the DOM.
| Method | Description |
| --- | --- |
| `$().alert()` | Makes an alert listen for click events on descendant elements which have the `data-dismiss="alert"` attribute. (Not necessary when using the data-api's auto-initialization.) |
| `$().alert('close')` | Closes an alert by removing it from the DOM. If the `.fade` and `.in` classes are present on the element, the alert will fade out before it is removed. |
| `$().alert('close')` | Closes an alert by removing it from the DOM. If the `.fade` and `.show` classes are present on the element, the alert will fade out before it is removed. |

{% highlight js %}$(".alert").alert('close'){% endhighlight %}

Expand Down
8 changes: 4 additions & 4 deletions docs/components/collapse.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Click the buttons below to show and hide another element via class changes:

- `.collapse` hides content
- `.collapsing` is applied during transitions
- `.collapse.active` shows content
- `.collapse.show` shows content

You can use a link with the `href` attribute, or a button with the `data-target` attribute. In both cases, the `data-toggle="collapse"` is required.

Expand Down Expand Up @@ -53,7 +53,7 @@ Extend the default collapse behavior to create an accordion.
</h5>
</div>

<div id="collapseOne" class="collapse active" role="tabpanel" aria-labelledby="headingOne">
<div id="collapseOne" class="collapse show" role="tabpanel" aria-labelledby="headingOne">
<div class="card-block">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
Expand Down Expand Up @@ -101,14 +101,14 @@ Additionally, if your control element is targeting a single collapsible element
The collapse plugin utilizes a few classes to handle the heavy lifting:

- `.collapse` hides the content
- `.collapse.active` shows the content
- `.collapse.show` shows the content
- `.collapsing` is added when the transition starts, and removed when it finishes

These classes can be found in `_animation.scss`.

### Via data attributes

Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `active`.
Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `show`.

To add accordion-like group management to a collapsible control, add the data attribute `data-parent="#selector"`. Refer to the demo to see this in action.

Expand Down
8 changes: 4 additions & 4 deletions docs/components/dropdowns.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.
Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either `<button>` elements:

{% example html %}
<div class="dropdown active">
<div class="dropdown show">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
Expand All @@ -36,7 +36,7 @@ Any single `.btn` can be turned into a dropdown toggle with some markup changes.
And with `<a>` elements:

{% example html %}
<div class="dropdown active">
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="https://example.com" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
Expand Down Expand Up @@ -407,7 +407,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
Historically dropdown menu contents *had* to be links, but that's no longer the case with v4. Now you can optionally use `<button>` elements in your dropdowns instead of just `<a>`s.

{% example html %}
<div class="dropdown active">
<div class="dropdown show">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</button>
Expand Down Expand Up @@ -480,7 +480,7 @@ Add `.disabled` to items in the dropdown to **style them as disabled**.

## Usage

Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.active` class on the parent list item.
Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.show` class on the parent list item.

On mobile devices, opening a dropdown adds a `.dropdown-backdrop` as a tap area for closing dropdown menus when tapping outside the menu, a requirement for proper iOS support. **This means that switching from an open dropdown menu to a different dropdown menu requires an extra tap on mobile.**

Expand Down
6 changes: 3 additions & 3 deletions docs/components/navs.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Use the tab JavaScript plugin—include it individually or through the compiled
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div role="tabpanel" class="tab-pane fade in active" id="home" aria-labelledBy="home-tab">
<div role="tabpanel" class="tab-pane fade show active" id="home" aria-labelledBy="home-tab">
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledBy="profile-tab">
Expand Down Expand Up @@ -390,11 +390,11 @@ $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)

### Fade effect

To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.in` to make the initial content visible.
To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.show` to make the initial content visible.

{% highlight html %}
<div class="tab-content">
<div class="tab-pane fade in active" id="home" role="tabpanel">...</div>
<div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show and active?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think of .show as it "showing" the fade animation, while .active is the one that is currently selected.

<div class="tab-pane fade" id="profile" role="tabpanel">...</div>
<div class="tab-pane fade" id="messages" role="tabpanel">...</div>
<div class="tab-pane fade" id="settings" role="tabpanel">...</div>
Expand Down
8 changes: 4 additions & 4 deletions js/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const Alert = (($) => {
}

const ClassName = {
ALERT : 'alert',
FADE : 'fade',
ACTIVE : 'active'
ALERT : 'alert',
FADE : 'fade',
SHOW : 'show'
}


Expand Down Expand Up @@ -108,7 +108,7 @@ const Alert = (($) => {
}

_removeElement(element) {
$(element).removeClass(ClassName.ACTIVE)
$(element).removeClass(ClassName.SHOW)

if (!Util.supportsTransitionEnd() ||
!$(element).hasClass(ClassName.FADE)) {
Expand Down
16 changes: 8 additions & 8 deletions js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Collapse = (($) => {
}

const ClassName = {
ACTIVE : 'active',
SHOW : 'show',
COLLAPSE : 'collapse',
COLLAPSING : 'collapsing',
COLLAPSED : 'collapsed'
Expand All @@ -56,7 +56,7 @@ const Collapse = (($) => {
}

const Selector = {
ACTIVES : '.card > .active, .card > .collapsing',
ACTIVES : '.card > .show, .card > .collapsing',
DATA_TOGGLE : '[data-toggle="collapse"]'
}

Expand Down Expand Up @@ -104,7 +104,7 @@ const Collapse = (($) => {
// public

toggle() {
if ($(this._element).hasClass(ClassName.ACTIVE)) {
if ($(this._element).hasClass(ClassName.SHOW)) {
this.hide()
} else {
this.show()
Expand All @@ -116,7 +116,7 @@ const Collapse = (($) => {
throw new Error('Collapse is transitioning')
}

if ($(this._element).hasClass(ClassName.ACTIVE)) {
if ($(this._element).hasClass(ClassName.SHOW)) {
return
}

Expand Down Expand Up @@ -171,7 +171,7 @@ const Collapse = (($) => {
$(this._element)
.removeClass(ClassName.COLLAPSING)
.addClass(ClassName.COLLAPSE)
.addClass(ClassName.ACTIVE)
.addClass(ClassName.SHOW)

this._element.style[dimension] = ''

Expand Down Expand Up @@ -200,7 +200,7 @@ const Collapse = (($) => {
throw new Error('Collapse is transitioning')
}

if (!$(this._element).hasClass(ClassName.ACTIVE)) {
if (!$(this._element).hasClass(ClassName.SHOW)) {
return
}

Expand All @@ -221,7 +221,7 @@ const Collapse = (($) => {
$(this._element)
.addClass(ClassName.COLLAPSING)
.removeClass(ClassName.COLLAPSE)
.removeClass(ClassName.ACTIVE)
.removeClass(ClassName.SHOW)

this._element.setAttribute('aria-expanded', false)

Expand Down Expand Up @@ -299,7 +299,7 @@ const Collapse = (($) => {

_addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
const isOpen = $(element).hasClass(ClassName.ACTIVE)
const isOpen = $(element).hasClass(ClassName.SHOW)
element.setAttribute('aria-expanded', isOpen)

if (triggerArray.length) {
Expand Down
12 changes: 6 additions & 6 deletions js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Dropdown = (($) => {
const ClassName = {
BACKDROP : 'dropdown-backdrop',
DISABLED : 'disabled',
ACTIVE : 'active'
SHOW : 'show'
}

const Selector = {
Expand Down Expand Up @@ -86,7 +86,7 @@ const Dropdown = (($) => {
}

const parent = Dropdown._getParentFromElement(this)
const isActive = $(parent).hasClass(ClassName.ACTIVE)
const isActive = $(parent).hasClass(ClassName.SHOW)

Dropdown._clearMenus()

Expand Down Expand Up @@ -118,7 +118,7 @@ const Dropdown = (($) => {
this.focus()
this.setAttribute('aria-expanded', true)

$(parent).toggleClass(ClassName.ACTIVE)
$(parent).toggleClass(ClassName.SHOW)
$(parent).trigger($.Event(Event.SHOWN, relatedTarget))

return false
Expand Down Expand Up @@ -176,7 +176,7 @@ const Dropdown = (($) => {
relatedTarget : toggles[i]
}

if (!$(parent).hasClass(ClassName.ACTIVE)) {
if (!$(parent).hasClass(ClassName.SHOW)) {
continue
}

Expand All @@ -195,7 +195,7 @@ const Dropdown = (($) => {
toggles[i].setAttribute('aria-expanded', 'false')

$(parent)
.removeClass(ClassName.ACTIVE)
.removeClass(ClassName.SHOW)
.trigger($.Event(Event.HIDDEN, relatedTarget))
}
}
Expand Down Expand Up @@ -225,7 +225,7 @@ const Dropdown = (($) => {
}

const parent = Dropdown._getParentFromElement(this)
const isActive = $(parent).hasClass(ClassName.ACTIVE)
const isActive = $(parent).hasClass(ClassName.SHOW)

if (!isActive && event.which !== ESCAPE_KEYCODE ||
isActive && event.which === ESCAPE_KEYCODE) {
Expand Down
10 changes: 5 additions & 5 deletions js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Modal = (($) => {
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
ACTIVE : 'active'
SHOW : 'show'
}

const Selector = {
Expand Down Expand Up @@ -185,7 +185,7 @@ const Modal = (($) => {

$(document).off(Event.FOCUSIN)

$(this._element).removeClass(ClassName.ACTIVE)
$(this._element).removeClass(ClassName.SHOW)

$(this._element).off(Event.CLICK_DISMISS)
$(this._dialog).off(Event.MOUSEDOWN_DISMISS)
Expand Down Expand Up @@ -242,7 +242,7 @@ const Modal = (($) => {
Util.reflow(this._element)
}

$(this._element).addClass(ClassName.ACTIVE)
$(this._element).addClass(ClassName.SHOW)

if (this._config.focus) {
this._enforceFocus()
Expand Down Expand Up @@ -356,7 +356,7 @@ const Modal = (($) => {
Util.reflow(this._backdrop)
}

$(this._backdrop).addClass(ClassName.ACTIVE)
$(this._backdrop).addClass(ClassName.SHOW)

if (!callback) {
return
Expand All @@ -372,7 +372,7 @@ const Modal = (($) => {
.emulateTransitionEnd(BACKDROP_TRANSITION_DURATION)

} else if (!this._isShown && this._backdrop) {
$(this._backdrop).removeClass(ClassName.ACTIVE)
$(this._backdrop).removeClass(ClassName.SHOW)

const callbackRemove = () => {
this._removeBackdrop()
Expand Down
6 changes: 3 additions & 3 deletions js/src/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const Popover = (($) => {
})

const ClassName = {
FADE : 'fade',
ACTIVE : 'active'
FADE : 'fade',
SHOW : 'show'
}

const Selector = {
Expand Down Expand Up @@ -117,7 +117,7 @@ const Popover = (($) => {
this.setElementContent($tip.find(Selector.TITLE), this.getTitle())
this.setElementContent($tip.find(Selector.CONTENT), this._getContent())

$tip.removeClass(`${ClassName.FADE} ${ClassName.ACTIVE}`)
$tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)

this.cleanupTether()
}
Expand Down
6 changes: 3 additions & 3 deletions js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Tab = (($) => {
DROPDOWN_MENU : 'dropdown-menu',
ACTIVE : 'active',
FADE : 'fade',
IN : 'in'
SHOW : 'show'
}

const Selector = {
Expand Down Expand Up @@ -173,7 +173,7 @@ const Tab = (($) => {
}

if (active) {
$(active).removeClass(ClassName.IN)
$(active).removeClass(ClassName.SHOW)
}
}

Expand All @@ -197,7 +197,7 @@ const Tab = (($) => {

if (isTransitioning) {
Util.reflow(element)
$(element).addClass(ClassName.IN)
$(element).addClass(ClassName.SHOW)
} else {
$(element).removeClass(ClassName.FADE)
}
Expand Down
Loading