Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 4c2d0a8

Browse files
author
george
committed
Merge branch 'develop'
2 parents 55a7e6d + 81b0dcb commit 4c2d0a8

20 files changed

+148
-134
lines changed

dist/undernet.bundle.esm.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* @license MIT (https://github.com/geotrev/undernet/blob/master/LICENSE)
3-
* Undernet v4.3.0 (https://undernet.io)
3+
* Undernet v4.4.0 (https://undernet.io)
44
* Copyright 2017-2019 George Treviranus
55
*/
66
const KeyCodes = {
@@ -21,6 +21,9 @@ const Events = {
2121
CLICK: "click",
2222
};
2323

24+
/**
25+
* Simple DOM manipulator methods. NOTE: These aren't chainable.
26+
*/
2427
const dom = {
2528
attr: (element, attr, newValue) => {
2629
if (newValue === false) {
@@ -57,6 +60,9 @@ const dom = {
5760
},
5861
};
5962

63+
/**
64+
* Return an array literal of elements matching focusable elements within a given container.
65+
*/
6066
const getFocusableElements = container => {
6167
const focusables = Selectors.FOCUSABLE_TAGS.map(
6268
element => `${container} ${element}${Selectors.NOT_VISUALLY_HIDDEN_CLASS}`
@@ -65,8 +71,15 @@ const getFocusableElements = container => {
6571
return dom.findAll(focusables)
6672
};
6773

74+
/**
75+
* Check if the current browser session is within an Apple device.
76+
*/
6877
const iOSMobile = /(iphone|ipod|ipad)/i.test(navigator.userAgent);
6978

79+
/**
80+
* Utility class to help with focus trapping and keyboard outline management.
81+
* Components extend from this method.
82+
*/
7083
class Utils {
7184
constructor() {
7285
// events
@@ -284,41 +297,40 @@ class Accordion extends Utils {
284297
// private
285298

286299
_setup(instance) {
287-
const buttonId = dom.attr(instance, Selectors$1.DATA_TARGET);
300+
const buttonTargetId = dom.attr(instance, Selectors$1.DATA_TARGET);
288301
const accordionId = dom.attr(instance, Selectors$1.DATA_PARENT);
289-
const buttonContent = dom.find(`#${buttonId}`);
302+
const buttonContent = dom.find(`#${buttonTargetId}`);
290303

291304
if (!accordionId) {
292-
throw new Error(Messages.NO_ACCORDION_ID_ERROR(buttonId))
305+
throw new Error(Messages.NO_ACCORDION_ID_ERROR(buttonTargetId))
293306
}
294307

295308
if (!buttonContent) {
296-
throw new Error(Messages.NO_CONTENT_ERROR(buttonId))
309+
throw new Error(Messages.NO_CONTENT_ERROR(buttonTargetId))
297310
}
298311

299-
const accordionRowAttr = this._getAccordionRowAttr(buttonId);
312+
const accordionRowAttr = this._getAccordionRowAttr(buttonTargetId);
300313
const accordionRow = dom.find(accordionRowAttr);
301314

302315
if (!accordionRow) {
303-
throw new Error(Messages.NO_ROW_ERROR(buttonId))
316+
throw new Error(Messages.NO_ROW_ERROR(buttonTargetId))
304317
}
305318

306-
const buttonHeaderSelector = this._headers.join(", ");
307-
const buttonHeader = dom.find(buttonHeaderSelector, accordionRow);
319+
const buttonId = instance.id;
308320

309-
if (!buttonHeader.id) {
321+
if (!buttonId) {
310322
throw new Error(Messages.NO_HEADER_ID_ERROR(accordionRowAttr))
311323
}
312324

313325
const buttonContentChildren = getFocusableElements(`#${buttonContent.id}`);
314326

315-
dom.attr(instance, Selectors$1.ARIA_CONTROLS, buttonId);
316-
dom.attr(buttonContent, Selectors$1.ARIA_LABELLEDBY, buttonHeader.id);
327+
dom.attr(instance, Selectors$1.ARIA_CONTROLS, buttonTargetId);
328+
dom.attr(buttonContent, Selectors$1.ARIA_LABELLEDBY, buttonId);
317329

318330
const contentShouldExpand = dom.attr(accordionRow, Selectors$1.DATA_VISIBLE);
319331

320332
if (!contentShouldExpand) {
321-
throw new Error(Messages.NO_VISIBLE_ERROR(buttonId))
333+
throw new Error(Messages.NO_VISIBLE_ERROR(buttonTargetId))
322334
}
323335

324336
if (contentShouldExpand === "true") {

dist/undernet.bundle.js

Lines changed: 12 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/undernet.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/undernet.bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/undernet.bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/undernet.css.zip

0 Bytes
Binary file not shown.

dist/undernet.js.zip

616 Bytes
Binary file not shown.

dist/undernet.modules.js.zip

140 Bytes
Binary file not shown.

dist/undernet.scss.zip

0 Bytes
Binary file not shown.

js/dist/accordion.js

Lines changed: 11 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)