Added Firefox support for making Order Summary sticky when not longer than view (#49744)

* Added getComputedStyle for Firefox support

* Added changelog

* Reverted pnpm-lock.yaml
This commit is contained in:
Paulo Arromba 2024-07-23 15:38:12 +01:00 committed by GitHub
parent 7e13bbcbf4
commit 3d148e2577
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -43,10 +43,22 @@ export function useObservedViewport< T extends HTMLElement >(): [
const resizeObserver = new ResizeObserver( ( entries ) => {
entries.forEach( ( entry ) => {
if ( entry.target === element ) {
let elementTop = '0';
if ( element.computedStyleMap ) {
elementTop =
element
.computedStyleMap()
.get( 'top' )
?.toString() || elementTop;
} else {
// Firefox support
elementTop =
getComputedStyle( element ).top || elementTop;
}
const { height, width } = entry.contentRect;
const elementTop =
element.computedStyleMap().get( 'top' )?.toString() ||
'0';
setObservedElement( {
height: height + parseInt( elementTop, 10 ),
width,

View File

@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Added computedStyleMap for Firefox support in making the Order Summary sticky when not longer than view