feat(framework): Maintain a common z-index for all UI5 Web Components instances and OpenUI5 #2980
+64
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce Common Popup Registry
1. Between different UI5 Web Components runtimes
A new Shared Resources entity was introduced:
PopupUtilsData
. You can test this in your browser as follows:Thus all UI5 Web Components runtimes will use the same
currentZIndex
value, stored on the globalui5-shared-resources
tag in thehead
.2. Between UI5 Web Components runtimes and OpenUI5
Whenever the
OpenUI5Support
feature is imported by an application:the OpenUI5 popup registry will be used as a source of truth for each popup, opened by UI5 Web Components. This would allow UI5 Web Components popups to stack correctly with OpenUI5 popups.
There are 2 possible scenarios regarding which framework is loaded first:
OpenUI5
is loaded first: when this is the case, nothing special needs to be done. The first UI5 Web Components popup to be opened will require a newz-index
value from OpenUI5 and will get the next eligible OpenUI5z-index
.OpenUI5
is loaded lazily after 1 or more popups have already been opened by UI5 Web Components. In this case, OpenUI5 will need to start from the lastz-index
value, used by UI5 Web Components, although it will still be the source of truth for future popups. In this case, after the application has loaded OpenUI5 on demand, it would need to explicitly synchronize its initialz-index
with the one from the UI5 Web Components shared registry.This will set OpenUI5's initial
z-index
value to whatever the current one for UI5 Web Components is. From then on, OpenUI5 will be used as a source of truth.Misc changes:
PopupUtils.js
moved to thebase
project as now the framework itself will be concerned withz-index
management.OpenUI5Support
feature will no longer assume that OpenUI5 is already loaded. Therefore the code that gets a reference to the core is moved from the module to a function (getCore
) and this function is called every time the presence of OpenUI5 needs to be re-evaluated. This is needed in order to support the OpenUI5 lazy-load scenario.BREAKING CHANGES:
@ui5/webcomponents/dist/popup-utils/PopupUtils.js
has been moved to thebase
package. Change your imports from:to:
closes: #2973