@financial-times/n-myft-ui 40.1.7 → 40.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.toolkitstate/ci.json
CHANGED
|
@@ -45,7 +45,7 @@ export default function InstantAlertsPreferencesModal({ flags, conceptId, visibl
|
|
|
45
45
|
</span>
|
|
46
46
|
|
|
47
47
|
<p data-component-id="myft-preferences-modal-list" className="n-myft-ui__preferences-modal__text"></p>
|
|
48
|
-
<a className="n-myft-ui__preferences-modal__text" href="/
|
|
48
|
+
<a className="n-myft-ui__preferences-modal__text" href="/myaccount/contact-preferences" data-trackable="pop-up-box|contact-preference" data-trackable-context-concept_id={conceptId}>Manage your delivery channels here</a>
|
|
49
49
|
<span className="n-myft-ui__preferences-modal-error" data-component-id="myft-preference-modal-error"></span>
|
|
50
50
|
<button className="n-myft-ui__preferences-modal__remove-button" data-component-id="myft-preference-modal-remove" data-trackable="pop-up-box|remove-from-myFT" data-trackable-context-concept_id={conceptId}>Remove from myFT</button>
|
|
51
51
|
</div>
|
|
@@ -70,7 +70,7 @@ function InstantAlertsPreferencesModal(_ref) {
|
|
|
70
70
|
_react2.default.createElement('p', { 'data-component-id': 'myft-preferences-modal-list', className: 'n-myft-ui__preferences-modal__text' }),
|
|
71
71
|
_react2.default.createElement(
|
|
72
72
|
'a',
|
|
73
|
-
{ className: 'n-myft-ui__preferences-modal__text', href: '/
|
|
73
|
+
{ className: 'n-myft-ui__preferences-modal__text', href: '/myaccount/contact-preferences', 'data-trackable': 'pop-up-box|contact-preference', 'data-trackable-context-concept_id': conceptId },
|
|
74
74
|
'Manage your delivery channels here'
|
|
75
75
|
),
|
|
76
76
|
_react2.default.createElement('span', { className: 'n-myft-ui__preferences-modal-error', 'data-component-id': 'myft-preference-modal-error' }),
|
package/myft/ui/lists.js
CHANGED
|
@@ -89,7 +89,9 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
|
89
89
|
|
|
90
90
|
function addCloseButtonDataTrackable () {
|
|
91
91
|
const closeBtn = document.querySelector('.o-overlay__close');
|
|
92
|
-
closeBtn
|
|
92
|
+
if (closeBtn) {
|
|
93
|
+
closeBtn.setAttribute('data-trackable', 'close-button');
|
|
94
|
+
}
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
function outsideClickHandler (e) {
|
|
@@ -100,9 +102,6 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
|
100
102
|
const isTargetInsideOverlay = overlayContainer.contains(e.target) && !e.target.classList.contains('o-overlay__close');
|
|
101
103
|
if(createListOverlay.visible && (!overlayContent || !isTargetInsideOverlay)) {
|
|
102
104
|
createListOverlay.close();
|
|
103
|
-
// When we close the list overlay we want to return the focuse to the trigger element
|
|
104
|
-
// This is for better accessibility and it will allow keyboard users to continue from where they left off when they opened the overlay
|
|
105
|
-
returnFocusToRefocusElement();
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
|
|
@@ -121,6 +120,14 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
|
121
120
|
refreshListElement();
|
|
122
121
|
showListElement();
|
|
123
122
|
restoreFormHandler();
|
|
123
|
+
focusOverlayCloseButton();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function focusOverlayCloseButton () {
|
|
127
|
+
const closeBtn = document.querySelector('.o-overlay__close');
|
|
128
|
+
if (closeBtn) {
|
|
129
|
+
closeBtn.focus();
|
|
130
|
+
}
|
|
124
131
|
}
|
|
125
132
|
|
|
126
133
|
function openFormHandler () {
|
|
@@ -154,25 +161,17 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
|
154
161
|
|
|
155
162
|
document.body.addEventListener('click', outsideClickHandler);
|
|
156
163
|
|
|
157
|
-
const closeBtn = document.querySelector('.o-overlay__close');
|
|
158
|
-
if(closeBtn){
|
|
159
|
-
// whenever we close the overlay we want to return the focuse to the trigger element
|
|
160
|
-
closeBtn.addEventListener('click', returnFocusToRefocusElement);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
164
|
});
|
|
164
165
|
|
|
165
166
|
createListOverlay.wrapper.addEventListener('oOverlay.destroy', () => {
|
|
167
|
+
// Restore focus regardless of close path (close button, outside click, Escape key).
|
|
168
|
+
returnFocusToRefocusElement();
|
|
169
|
+
|
|
166
170
|
window.removeEventListener('scroll', scrollHandler);
|
|
167
171
|
|
|
168
172
|
window.removeEventListener('oViewport.resize', resizeHandler);
|
|
169
173
|
|
|
170
174
|
document.body.removeEventListener('click', outsideClickHandler);
|
|
171
|
-
|
|
172
|
-
const closeBtn = document.querySelector('.o-overlay__close');
|
|
173
|
-
if (closeBtn) {
|
|
174
|
-
closeBtn.removeEventListener('click', returnFocusToRefocusElement);
|
|
175
|
-
}
|
|
176
175
|
});
|
|
177
176
|
|
|
178
177
|
addCloseButtonDataTrackable();
|