Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6039: splitter bug fixes #6040

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions components/lib/splitter/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,24 @@ export const Splitter = React.memo(
}

case 'Home': {
resizePanel(index, 100, minSize);
resizePanel(index, 100 - minSize, minSize);

event.preventDefault();
break;
}

case 'End': {
resizePanel(index, minSize, 100);
resizePanel(index, minSize, 100 - minSize);

event.preventDefault();
break;
}

case 'Enter': {
if (prevSize.current > 100 - (minSize || 5)) {
resizePanel(index, minSize, 100);
if (prevSize.current >= 100 - (minSize || 5)) {
resizePanel(index, minSize, 100 - minSize);
} else {
resizePanel(index, 100, minSize);
resizePanel(index, 100 - minSize, minSize);
}

event.preventDefault();
Expand Down Expand Up @@ -386,8 +386,7 @@ export const Splitter = React.memo(
onTouchStart: (event) => onGutterTouchStart(event, index),
onTouchMove: (event) => onGutterTouchMove(event),
onTouchEnd: (event) => onGutterTouchEnd(event),
'data-p-splitter-gutter-resizing': false,
role: 'separator'
'data-p-splitter-gutter-resizing': false
},
ptm('gutter')
);
Expand All @@ -396,6 +395,7 @@ export const Splitter = React.memo(
{
tabIndex: getPanelProp(panel, 'tabIndex') || 0,
className: cx('gutterHandler'),
role: 'separator',
'aria-orientation': horizontal ? 'vertical' : 'horizontal',
'aria-controls': panelId,
'aria-label': getPanelProp(panel, 'aria-label'),
Expand Down
14 changes: 7 additions & 7 deletions components/lib/splitter/__snapshots__/Splitter.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ exports[`Splitter Nested 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="width: 4px;"
>
<div
Expand All @@ -35,6 +34,7 @@ exports[`Splitter Nested 1`] = `
aria-valuetext="20%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -66,7 +66,6 @@ exports[`Splitter Nested 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="height: 4px;"
>
<div
Expand All @@ -78,6 +77,7 @@ exports[`Splitter Nested 1`] = `
aria-valuetext="15%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -109,7 +109,6 @@ exports[`Splitter Nested 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="width: 4px;"
>
<div
Expand All @@ -121,6 +120,7 @@ exports[`Splitter Nested 1`] = `
aria-valuetext="20%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -165,7 +165,6 @@ exports[`Splitter Single Panel with size 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="height: 4px;"
>
<div
Expand All @@ -177,6 +176,7 @@ exports[`Splitter Single Panel with size 1`] = `
aria-valuetext="5%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -207,7 +207,6 @@ exports[`Splitter Single Panel without size 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="height: 4px;"
>
<div
Expand All @@ -219,6 +218,7 @@ exports[`Splitter Single Panel without size 1`] = `
aria-valuetext="100%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -249,7 +249,6 @@ exports[`Splitter Splitter requires two SplitterPanel components to wrap. 1`] =
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="width: 4px;"
>
<div
Expand All @@ -261,6 +260,7 @@ exports[`Splitter Splitter requires two SplitterPanel components to wrap. 1`] =
aria-valuetext="50%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down Expand Up @@ -301,7 +301,6 @@ exports[`Splitter Vertical layout 1`] = `
class="p-splitter-gutter"
data-p-splitter-gutter-resizing="false"
data-pc-section="gutter"
role="separator"
style="height: 4px;"
>
<div
Expand All @@ -313,6 +312,7 @@ exports[`Splitter Vertical layout 1`] = `
aria-valuetext="50%"
class="p-splitter-gutter-handle"
data-pc-section="gutterhandler"
role="separator"
tabindex="0"
/>
</div>
Expand Down
10 changes: 5 additions & 5 deletions components/lib/splitter/splitter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ interface SplitterPanelProps extends Omit<React.DetailedHTMLProps<React.HTMLAttr
* @readonly
*/
children?: React.ReactNode | undefined;
/**
* Step factor to increment/decrement the size of the panels while pressing the arrow keys.
* @defaultValue 5
*/
step?: number | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {SplitterPanelPassThroughOptions}
Expand Down Expand Up @@ -196,6 +191,11 @@ export interface SplitterProps extends Omit<React.DetailedHTMLProps<React.HTMLAt
* @readonly
*/
children?: React.ReactNode | undefined;
/**
* Step factor to increment/decrement the size of the panels while pressing the arrow keys.
* @defaultValue 5
*/
step?: number | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {SplitterPassThroughOptions}
Expand Down
Loading