Skip to content

Commit f2d7de9

Browse files
authored
refactor: toggling visibility (#1421)
* refactor: toggling visibility by modern hidden attribute * refactor: toggling visibility by modern hidden attribute
1 parent 12e32b8 commit f2d7de9

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

packages/uikit-workshop/src/scripts/lit-components/pl-drawer/pl-drawer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,14 @@ class Drawer extends LitElement {
104104
: 300
105105
: 0;
106106

107-
const coverStyles = { display: this.isMouseDown ? 'block' : 'none' };
108107
const drawerStyles = {
109108
height: `${renderedHeight}px`,
110109
transitionDuration: this.isMouseDown ? '0ms' : '300ms',
111110
};
112111

113112
return html`
114113
<div>
115-
<div class="pl-c-drawer__cover" style="${styleMap(coverStyles)}"></div>
114+
<div class="pl-c-drawer__cover" ?hidden="${!this.isMouseDown}"></div>
116115
<div style="${styleMap(drawerStyles)}" class="pl-c-drawer__wrapper">
117116
<div class="pl-c-drawer__resizer" @mousedown="${this.onMouseDown}">
118117
<svg

packages/uikit-workshop/src/scripts/lit-components/pl-drawer/pl-drawer.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ pl-drawer {
144144
height: 100%;
145145
top: 0;
146146
left: 0;
147-
display: none;
148147
position: fixed;
149148
z-index: 20;
150149
cursor: move;

packages/uikit-workshop/src/scripts/lit-components/pl-viewport/pl-viewport.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ class IFrame extends BaseLitComponent {
405405

406406
return html`
407407
<div class="pl-c-viewport pl-js-viewport">
408-
<div class="pl-c-viewport__cover pl-js-viewport-cover"></div>
408+
<div class="pl-c-viewport__cover pl-js-viewport-cover" hidden></div>
409409
<div
410410
class="pl-c-viewport__iframe-wrapper pl-js-vp-iframe-container"
411411
style="width: ${initialWidth}"
@@ -450,7 +450,7 @@ class IFrame extends BaseLitComponent {
450450
this.fullMode = false;
451451

452452
// show the cover
453-
this.iframeCover.style.display = 'block';
453+
this.iframeCover.hidden = false;
454454

455455
function handleIframeCoverResize(e) {
456456
const viewportWidth = origViewportWidth + 2 * (e.clientX - origClientX);
@@ -476,7 +476,7 @@ class IFrame extends BaseLitComponent {
476476
'mousemove',
477477
handleIframeCoverResize
478478
);
479-
self.iframeCover.style.display = 'none';
479+
self.iframeCover.hidden = true;
480480
self
481481
.querySelector('.pl-js-resize-handle')
482482
.classList.remove('is-resizing');

packages/uikit-workshop/src/scripts/lit-components/pl-viewport/pl-viewport.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pl-iframe {
5757
.pl-c-viewport__cover {
5858
width: 100%;
5959
height: 100%;
60-
display: none;
6160
position: fixed;
6261
top: 0;
6362
left: 0;

0 commit comments

Comments
 (0)