Skip to content

Commit 4bd8d43

Browse files
authored
Fix pagedecorations hotspot (#275)
1 parent c963cd6 commit 4bd8d43

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

lib/kits/core-ui/components/paged-publication/main-container.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const defaultTemplate = `\
1111
</div>
1212
</div>
1313
14+
<div class="sgn-page_decorations"></div>
1415
1516
<button
1617
class="sgn-pp__control"
@@ -40,7 +41,6 @@ const defaultTemplate = `\
4041
>
4142
&laquo;
4243
</button>
43-
<div class="sgn-page_decorations"></div>
4444
<div class="sgn__header-container"></div>
4545
4646
{{#enableSidebar}}

lib/kits/paged-publication/hotspots.ts

+17-15
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,25 @@ function renderHotspot(hotspot, position, contentRect, boundingRect) {
9797
el.style.width = `${width}px`;
9898
el.style.height = `${height}px`;
9999

100-
el.setAttribute('tabindex', '-1');
101-
el.setAttribute(
102-
'aria-label',
103-
`${hotspot.offer.heading}; ${hotspot.offer.pricing.price} ${hotspot.offer.pricing.currency};`
104-
);
105-
106-
const observer = new IntersectionObserver((entries) => {
107-
entries.forEach((entry) => {
108-
if (entry.isIntersecting) {
109-
entry.target.setAttribute('tabindex', '0');
110-
} else {
111-
entry.target.setAttribute('tabindex', '-1');
112-
}
100+
if (hotspot.type === 'offer') {
101+
el.setAttribute('tabindex', '-1');
102+
el.setAttribute(
103+
'aria-label',
104+
`${hotspot.offer.heading}; ${hotspot.offer.pricing.price} ${hotspot.offer.pricing.currency};`
105+
);
106+
107+
const observer = new IntersectionObserver((entries) => {
108+
entries.forEach((entry) => {
109+
if (entry.isIntersecting) {
110+
entry.target.setAttribute('tabindex', '0');
111+
} else {
112+
entry.target.setAttribute('tabindex', '-1');
113+
}
114+
});
113115
});
114-
});
115116

116-
observer.observe(el);
117+
observer.observe(el);
118+
}
117119

118120
return el;
119121
}

0 commit comments

Comments
 (0)