Skip to content

Commit 1dd5c31

Browse files
authored
Merge pull request #977 from OutSystems/ROU-10963-v2
ROU-10963: Revert changes to sidebar
2 parents b15706d + 9ef5e5a commit 1dd5c31

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/scripts/OSFramework/OSUI/Behaviors/FocusTrap.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,31 @@ namespace OSFramework.OSUI.Behaviors {
123123

124124
// Method to set the focusable elements to be used
125125
private _setFocusableElements(includeTabIndexHidden = false): void {
126+
/**
127+
* NOTE: (MORE INFO @ROU-10963)
128+
* We can find 2 sections below that must be explained:
129+
* - TO BE REMOVED
130+
* - After the missing part of the code is implemented (mentioned at the bullet point below), code inside this section should be removed!
131+
* - TO KEEP
132+
* - With this implementation we ensure that the focusable elements are not part of the inner patterns
133+
* - However we still need to ensure focusable elements inside child patterns should be managed through their own FocusTrap
134+
* - For now code is not prepared to it, but it should be considered in the future, that's why we keep this implementation commented
135+
*/
136+
137+
/* TO BE REMOVED • START ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */
138+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
139+
includeTabIndexHidden = false;
140+
this._focusableElements = Helper.Dom.GetFocusableElements(this._targetElement, false);
141+
// Check if predicted elements exist at the _focusableElements
142+
for (const predictedElement of this._focusableElements.filter(
143+
(item) => item === this._predictableTopElement || item === this._predictableBottomElement
144+
)) {
145+
// If so, remove them from the array collection of _focusableElements
146+
this._focusableElements.splice(this._focusableElements.indexOf(predictedElement), 1);
147+
}
148+
/* TO BE REMOVED • END ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */
149+
150+
/* TO KEEP •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
126151
// Ensure the list of focusable elements is empty
127152
this._focusableElements.length = 0;
128153
@@ -151,6 +176,7 @@ namespace OSFramework.OSUI.Behaviors {
151176
}
152177
}
153178
}
179+
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */
154180

155181
// Remove the first element from array, because of predictable top element added for trapping
156182
this._firstFocusableElement = this._focusableElements[0];

0 commit comments

Comments
 (0)