Skip to content

Commit

Permalink
Merge pull request #977 from OutSystems/ROU-10963-v2
Browse files Browse the repository at this point in the history
ROU-10963: Revert changes to sidebar
  • Loading branch information
joselrio authored Aug 14, 2024
2 parents b15706d + 9ef5e5a commit 1dd5c31
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/scripts/OSFramework/OSUI/Behaviors/FocusTrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,31 @@ namespace OSFramework.OSUI.Behaviors {

// Method to set the focusable elements to be used
private _setFocusableElements(includeTabIndexHidden = false): void {
/**
* NOTE: (MORE INFO @ROU-10963)
* We can find 2 sections below that must be explained:
* - TO BE REMOVED
* - After the missing part of the code is implemented (mentioned at the bullet point below), code inside this section should be removed!
* - TO KEEP
* - With this implementation we ensure that the focusable elements are not part of the inner patterns
* - However we still need to ensure focusable elements inside child patterns should be managed through their own FocusTrap
* - For now code is not prepared to it, but it should be considered in the future, that's why we keep this implementation commented
*/

/* TO BE REMOVED • START ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
includeTabIndexHidden = false;
this._focusableElements = Helper.Dom.GetFocusableElements(this._targetElement, false);
// Check if predicted elements exist at the _focusableElements
for (const predictedElement of this._focusableElements.filter(
(item) => item === this._predictableTopElement || item === this._predictableBottomElement
)) {
// If so, remove them from the array collection of _focusableElements
this._focusableElements.splice(this._focusableElements.indexOf(predictedElement), 1);
}
/* TO BE REMOVED • END ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */

/* TO KEEP •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
// Ensure the list of focusable elements is empty
this._focusableElements.length = 0;
Expand Down Expand Up @@ -151,6 +176,7 @@ namespace OSFramework.OSUI.Behaviors {
}
}
}
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */

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

0 comments on commit 1dd5c31

Please sign in to comment.