diff --git a/components/lib/basedirective/BaseDirective.js b/components/lib/basedirective/BaseDirective.js index df15d6be3..917e0a7ba 100644 --- a/components/lib/basedirective/BaseDirective.js +++ b/components/lib/basedirective/BaseDirective.js @@ -15,12 +15,13 @@ const BaseDirective = { : ObjectUtils.getItemValue(options, params); }, _getPTValue: (instance = {}, obj = {}, key = '', params = {}, searchInDefaultPT = true) => { - const datasetPrefix = 'data-pc-'; + const name = ObjectUtils.convertToFlatCase(instance.$name); + const datasetPrefix = name ? `data-pd-${name}` : ''; const self = BaseDirective._getOptionValue(obj, key, params); const globalPT = searchInDefaultPT ? BaseDirective._getOptionValue(instance.defaultPT, key, params) : undefined; const merged = mergeProps(self, globalPT, { - ...(key === 'root' && instance.$name !== 'focustrap' && { [`${datasetPrefix}name`]: ObjectUtils.convertToFlatCase(instance.$name) }), - [`${datasetPrefix}section`]: ObjectUtils.convertToFlatCase(key) + ...(key === 'root' && { [datasetPrefix]: true }), + [`${datasetPrefix}-section`]: ObjectUtils.convertToFlatCase(key) }); return merged; diff --git a/components/lib/focustrap/FocusTrap.js b/components/lib/focustrap/FocusTrap.js index 7aba3a346..763a0659a 100644 --- a/components/lib/focustrap/FocusTrap.js +++ b/components/lib/focustrap/FocusTrap.js @@ -107,11 +107,11 @@ const FocusTrap = BaseFocusTrap.extend('focustrap', { firstFocusableElement.$_pfocustrap_lasthiddenfocusableelement = lastFocusableElement; firstFocusableElement.$_pfocustrap_focusableselector = firstFocusableSelector; - firstFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement'); + firstFocusableElement.setAttribute('data-pd-focustrap-section', 'firstfocusableelement'); lastFocusableElement.$_pfocustrap_firsthiddenfocusableelement = firstFocusableElement; lastFocusableElement.$_pfocustrap_focusableselector = lastFocusableSelector; - lastFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement'); + lastFocusableElement.setAttribute('data-pd-focustrap-section', 'lastfocusableelement'); el.prepend(firstFocusableElement); el.append(lastFocusableElement); diff --git a/components/lib/ripple/Ripple.js b/components/lib/ripple/Ripple.js index 5f9b01c7d..d56dd097a 100644 --- a/components/lib/ripple/Ripple.js +++ b/components/lib/ripple/Ripple.js @@ -91,13 +91,7 @@ const Ripple = BaseRipple.extend('ripple', { event.currentTarget.setAttribute('data-p-ink-active', 'false'); }, getInk(el) { - for (let i = 0; i < el.children.length; i++) { - if (el.children[i].getAttribute('data-pc-name') === 'ripple') { - return el.children[i]; - } - } - - return null; + return el && el.children ? [...el.children].find((child) => DomHandler.getAttribute(child, 'data-pd-ripple')) : undefined; } } });