Skip to content

Commit

Permalink
Fix #3122: Prevent overlay flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Nov 25, 2022
1 parent 3fa91b3 commit 243b1c4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
14 changes: 8 additions & 6 deletions components/doc/sidebar/sizedoc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { Sidebar } from '../../lib/sidebar/Sidebar';
import { Button } from '../../lib/button/Button';
import { Sidebar } from '../../lib/sidebar/Sidebar';
import { DocSectionCode } from '../common/docsectioncode';
import { DocSectionText } from '../common/docsectiontext';

Expand All @@ -9,7 +9,7 @@ export function SizeDoc(props) {

const code = {
basic: `
<Sidebar visible={visibleLeft} position="left" style={{ width: '20em' }} onHide={() => setVisibleLeft(false)}>
<Sidebar visible={visibleLeft} position="left" style={{ width: '30em' }} onHide={() => setVisibleLeft(false)}>
<h3>Sidebar Size</h3>
</Sidebar>
<Button icon="pi pi-arrow-left" onClick={() => setVisibleLeft(true)} className="mr-2" />
Expand All @@ -24,7 +24,7 @@ export default function SizeDoc() {
return (
<div>
<Sidebar visible={visibleLeft} position="left" style={{ width: '20em' }} onHide={() => setVisibleLeft(false)}>
<Sidebar visible={visibleLeft} position="left" style={{ width: '30em' }} onHide={() => setVisibleLeft(false)}>
<h3>Sidebar Size</h3>
</Sidebar>
<Button icon="pi pi-arrow-left" onClick={() => setVisibleLeft(true)} className="mr-2" />
Expand All @@ -42,7 +42,7 @@ export default function SizeDoc() {
return (
<div>
<Sidebar visible={visibleLeft} position="left" style={{ width: '20em' }} onHide={() => setVisibleLeft(false)}>
<Sidebar visible={visibleLeft} position="left" style={{ width: '30em' }} onHide={() => setVisibleLeft(false)}>
<h3>Sidebar Size</h3>
</Sidebar>
<Button icon="pi pi-arrow-left" onClick={() => setVisibleLeft(true)} className="mr-2" />
Expand All @@ -55,10 +55,12 @@ export default function SizeDoc() {
return (
<>
<DocSectionText {...props}>
<p>Sidebar size can be changed using a fixed value or using one of the three predefined ones.</p>
<p>
Sidebar size can be changed using a fixed style value or using one of the three predefined classes <i>p-sidebar-sm</i>, <i>p-sidebar-md</i>, <i>p-sidebar-lg</i>.
</p>
</DocSectionText>
<div className="card flex justify-content-center">
<Sidebar visible={visibleLeft} position="left" style={{ width: '20em' }} onHide={() => setVisibleLeft(false)}>
<Sidebar visible={visibleLeft} position="left" style={{ width: '30em' }} onHide={() => setVisibleLeft(false)}>
<h3>Sidebar Size</h3>
</Sidebar>
<Button icon="pi pi-arrow-left" onClick={() => setVisibleLeft(true)} className="mr-2" />
Expand Down
5 changes: 5 additions & 0 deletions components/lib/dialog/Dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
position: relative;
}

/* Github #3122: Prevent animation flickering */
.p-dialog:not([class*='p-dialog-']) {
display: none;
}

.p-dialog-content {
overflow-y: auto;
flex-grow: 1;
Expand Down
3 changes: 2 additions & 1 deletion components/lib/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ export const Dialog = React.forwardRef((props, ref) => {
const otherProps = ObjectUtils.findDiffKeys(props, Dialog.defaultProps);
const className = classNames('p-dialog p-component', props.className, {
'p-dialog-rtl': props.rtl,
'p-dialog-maximized': maximized
'p-dialog-maximized': maximized,
'p-dialog-normal': !maximized
});
const maskClassName = classNames(
'p-dialog-mask',
Expand Down
3 changes: 3 additions & 0 deletions components/lib/menu/Menu.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.p-menu-overlay {
position: absolute;
/* Github #3122: Prevent animation flickering */
top: -9999px;
left: -9999px;
}

.p-menu ul {
Expand Down
4 changes: 3 additions & 1 deletion components/lib/overlaypanel/OverlayPanel.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.p-overlaypanel {
position: absolute;
margin-top: 10px;
/* Github #3122: Prevent animation flickering */
top: -9999px;
left: -9999px;
}


.p-overlaypanel-flipped {
margin-top: 0;
margin-bottom: 10px;
Expand Down
5 changes: 5 additions & 0 deletions components/lib/sidebar/Sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
position: relative;
}

/* Github #3122: Prevent animation flickering */
.p-sidebar:not([class*="p-sidebar-"]){
display: none;
}

.p-sidebar-content {
overflow-y: auto;
flex-grow: 1;
Expand Down

0 comments on commit 243b1c4

Please sign in to comment.