Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Claro's polyfill enhancements for HTML5 details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
(($, Modernizr, Drupal) => {
|
|
|
|
/**
|
|
|
|
* Workaround for Firefox.
|
|
|
|
*
|
|
|
|
* Firefox applies the focus state only for keyboard navigation.
|
|
|
|
* We have to manually trigger focus to make the behavior consistent across
|
|
|
|
* browsers.
|
|
|
|
*
|
|
|
|
* @type {Drupal~behavior}
|
|
|
|
*/
|
|
|
|
Drupal.behaviors.claroDetails = {
|
|
|
|
attach(context) {
|
2021-08-10 10:05:02 +00:00
|
|
|
// The second argument of once() needs to be an instance of Element, but
|
|
|
|
// document is an instance of Document, replace it with the html Element.
|
|
|
|
$(once('claroDetails', context === document ? 'html' : context)).on(
|
|
|
|
'click',
|
|
|
|
(event) => {
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
if (event.target.nodeName === 'SUMMARY') {
|
|
|
|
$(event.target).trigger('focus');
|
|
|
|
}
|
2021-08-10 10:05:02 +00:00
|
|
|
},
|
|
|
|
);
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Workaround for non-supporting browsers.
|
|
|
|
*
|
|
|
|
* This shim extends HTML5 Shiv used by core.
|
|
|
|
*
|
|
|
|
* HTML5 Shiv toggles focused details for hitting enter. We copy that for
|
|
|
|
* space key as well to make the behavior consistent across browsers.
|
|
|
|
*
|
|
|
|
* @type {Drupal~behavior}
|
|
|
|
*/
|
|
|
|
Drupal.behaviors.claroDetailsToggleShim = {
|
|
|
|
attach(context) {
|
|
|
|
if (Modernizr.details || !Drupal.CollapsibleDetails.instances.length) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-10 10:05:02 +00:00
|
|
|
$(once('claroDetailsToggleShim', 'details .details-title', context)).on(
|
|
|
|
'keypress',
|
|
|
|
(event) => {
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
const keyCode = event.keyCode || event.charCode;
|
|
|
|
if (keyCode === 32) {
|
2020-10-21 10:41:33 +00:00
|
|
|
$(event.target).closest('summary').trigger('click');
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
event.preventDefault();
|
|
|
|
}
|
2021-08-10 10:05:02 +00:00
|
|
|
},
|
|
|
|
);
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
},
|
|
|
|
};
|
Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev, ayushmishra206, vsujeetkumar, mbroere, mrinalini9, Knee-X, vacho, priyanka.sahni, jaspreetsingh31, paulocs, sokru, joum, kwoxer, yoroy, lauriii, rootwork, droplet: Current element values missing from vertical tabs when shown in 2-column layout
2020-09-18 14:42:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Theme override providing a wrapper for summarized details content.
|
|
|
|
*
|
|
|
|
* @return {string}
|
|
|
|
* The markup for the element that will contain the summarized content.
|
|
|
|
*/
|
|
|
|
Drupal.theme.detailsSummarizedContentWrapper = () =>
|
|
|
|
`<span class="claro-details__summary-summary"></span>`;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Theme override of summarized details content text.
|
|
|
|
*
|
|
|
|
* @param {string|null} [text]
|
|
|
|
* (optional) The summarized content displayed in the summary.
|
|
|
|
* @return {string}
|
|
|
|
* The formatted summarized content text.
|
|
|
|
*/
|
2020-10-21 10:41:33 +00:00
|
|
|
Drupal.theme.detailsSummarizedContentText = (text) => text || '';
|
Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core
2019-10-13 20:42:58 +00:00
|
|
|
})(jQuery, Modernizr, Drupal);
|