FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: align expandable section with PatternFly and upgrade to PF 6.6.0 · patternfly-java/patternfly-java@f32a23d · GitHub

Commit f32a23d

Browse files
committed
fix: align expandable section with PatternFly and upgrade to PF 6.6.0
- Fix ExpandableSection to only apply expandTop modifier when not truncating - Add HTMLContainerBuilder factory methods to ExpandableSectionToggle - Remove duplicate CSS class on toggle button - Fix FormFieldGroup to use expandable parameter instead of hardcoded false - Upgrade PatternFly from 6.5.2 to 6.6.0 - Add peerDependencyRules for unused React peer deps in showcase - Add pf-compare report for expandable component
1 parent ba95c45 commit f32a23d

9 files changed

Lines changed: 335 additions & 41 deletions

File tree

‎components/src/main/java/org/patternfly/component/expandable/ExpandableSection.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private void afterWire() {
358358
// content after toggle => direction = down
359359
directionUp = false;
360360
}
361-
if (directionUp) {
361+
if (directionUp && truncate == 0) {
362362
contentEsElement.classList.add(modifier(expandTop));
363363
}
364364
if (truncate > 0) {

‎components/src/main/java/org/patternfly/component/expandable/ExpandableSectionToggle.java‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.patternfly.component.expandable;
1717

1818
import org.jboss.elemento.ElementContainerDelegate;
19+
import org.jboss.elemento.HTMLContainerBuilder;
1920
import org.patternfly.component.button.Button;
2021

2122
import elemental2.dom.Element;
@@ -44,15 +45,29 @@ public class ExpandableSectionToggle extends ExpandableSectionSubComponent<HTMLE
4445
// ------------------------------------------------------ factory
4546

4647
public static ExpandableSectionToggle expandableSectionToggle() {
47-
return new ExpandableSectionToggle(null, null);
48+
return new ExpandableSectionToggle(div(), null, null);
4849
}
4950

5051
public static ExpandableSectionToggle expandableSectionToggle(String moreText) {
51-
return new ExpandableSectionToggle(moreText, null);
52+
return new ExpandableSectionToggle(div(), moreText, null);
5253
}
5354

5455
public static ExpandableSectionToggle expandableSectionToggle(String moreText, String lessText) {
55-
return new ExpandableSectionToggle(moreText, lessText);
56+
return new ExpandableSectionToggle(div(), moreText, lessText);
57+
}
58+
59+
public static <E extends HTMLElement> ExpandableSectionToggle expandableSectionToggle(HTMLContainerBuilder<E> builder) {
60+
return new ExpandableSectionToggle(builder, null, null);
61+
}
62+
63+
public static <E extends HTMLElement> ExpandableSectionToggle expandableSectionToggle(HTMLContainerBuilder<E> builder,
64+
String moreText) {
65+
return new ExpandableSectionToggle(builder, moreText, null);
66+
}
67+
68+
public static <E extends HTMLElement> ExpandableSectionToggle expandableSectionToggle(HTMLContainerBuilder<E> builder,
69+
String moreText, String lessText) {
70+
return new ExpandableSectionToggle(builder, moreText, lessText);
5671
}
5772

5873
// ------------------------------------------------------ instance
@@ -65,14 +80,14 @@ public static ExpandableSectionToggle expandableSectionToggle(String moreText, S
6580
private String moreText;
6681
private String lessText;
6782

68-
ExpandableSectionToggle(String moreText, String lessText) {
69-
super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, div().css(component(expandableSection, toggle)).element());
83+
<E extends HTMLElement> ExpandableSectionToggle(HTMLContainerBuilder<E> builder, String moreText, String lessText) {
84+
super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, builder.css(component(expandableSection, toggle)).element());
7085
this.moreText = moreText;
7186
this.lessText = lessText;
7287
this.iconContainer = span().css(component(expandableSection, toggle, icon))
7388
.add(caretRight())
7489
.element();
75-
this.button = button().css(component(expandableSection, toggle))
90+
this.button = button()
7691
.link()
7792
.aria(expanded, false)
7893
.iconAndText(iconContainer, moreText, start)

‎components/src/main/java/org/patternfly/component/form/FormFieldGroup.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static FormFieldGroup formFieldGroup(boolean expandable) {
8282
.attr(role, group)
8383
.element());
8484
this.titleId = Id.unique(ComponentType.Form.id, SUB_COMPONENT_ID, "title");
85-
this.expandable = false;
85+
this.expandable = expandable;
8686
storeSubComponent();
8787
Attachable.register(this, this);
8888
}

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<version.gwt.safehtml>1.0.0-RC1</version.gwt.safehtml> <!-- Only used to link the API doc -->
9090
<version.junit>6.1.1</version.junit>
9191
<version.node>v26.3.1</version.node>
92-
<version.patternfly>6.5.2</version.patternfly>
92+
<version.patternfly>6.6.0</version.patternfly>
9393

9494
<!-- Plugin versions -->
9595
<version.central.publishing.plugin>0.11.0</version.central.publishing.plugin>

‎reports/pf-compare/expandable.json‎

Lines changed: 152 additions & 0 deletions
Large diffs are not rendered by default.

‎reports/pf-compare/expandable.md‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
component: expandable-section
3+
date: 2026-07-07
4+
pf_version: Release 6.6.0
5+
pf_url: https://www.patternfly.org/components/expandable-section
6+
pfj_url: http://localhost:1234/components/expandable-section
7+
sections:
8+
pf_count: 10
9+
pfj_count: 8
10+
matched: 7
11+
missing_in_pfj:
12+
- Uncontrolled
13+
- Uncontrolled with dynamic toggle content (function)
14+
- With heading semantics
15+
extra_in_pfj:
16+
- Detached (after)
17+
---
18+
19+
# PF Compare: expandable-section
20+
21+
## Section Coverage
22+
23+
| # | PF Section | PFJ Section | Group | Status |
24+
|---|------------|-------------|-------|--------|
25+
| 1 | Basic | Basic | Examples | matched |
26+
| 2 | Uncontrolled | --- | Examples | missing_in_pfj |
27+
| 3 | Uncontrolled with dynamic toggle text | Basic with dynamic toggle text | Examples | semantic_match |
28+
| 4 | Uncontrolled with dynamic toggle content (function) | --- | Examples | missing_in_pfj |
29+
| 5 | Detached | Detached (before) | Examples | semantic_match |
30+
| 6 | --- | Detached (after) | Examples | extra_in_pfj |
31+
| 7 | Disclosure variation | Disclosure variation | Examples | matched |
32+
| 8 | Indented expandable content | Indented | Examples | semantic_match |
33+
| 9 | With custom toggle content | With custom toggle content | Examples | matched |
34+
| 10 | With heading semantics | --- | Examples | missing_in_pfj |
35+
| 11 | Truncate expansion | Truncate | Examples | semantic_match |
36+
37+
## DOM Differences
38+
39+
### Basic
40+
41+
**Status:** differences_found
42+
43+
#### P2: Modifier Differences
44+
- PFJ `<button>` has extra class `pf-v6-c-expandable-section__toggle` alongside `pf-v6-c-button`. PF only has `pf-v6-c-button` on the button; the `__toggle` class is on the wrapper `<div>`.
45+
46+
#### P4: Icon Differences
47+
- Toggle icon: PF viewBox `0 0 20 20` (chevron-down), PFJ viewBox `0 0 32 32` (caret-right with CSS rotation)
48+
49+
### Basic with dynamic toggle text
50+
51+
**Status:** differences_found
52+
53+
#### P2: Modifier Differences
54+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
55+
56+
#### P4: Icon Differences
57+
- Same as Basic: PF viewBox `0 0 20 20`, PFJ viewBox `0 0 32 32`.
58+
59+
### Detached
60+
61+
**Status:** differences_found
62+
63+
#### P2: Modifier Differences
64+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
65+
66+
#### P4: Icon Differences
67+
- Same as Basic: PF viewBox `0 0 20 20`, PFJ viewBox `0 0 32 32`.
68+
69+
### Disclosure variation
70+
71+
**Status:** differences_found
72+
73+
#### P2: Modifier Differences
74+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
75+
- Root modifiers `pf-m-display-lg pf-m-limit-width` match correctly.
76+
77+
#### P4: Icon Differences
78+
- Same as Basic: PF viewBox `0 0 20 20`, PFJ viewBox `0 0 32 32`.
79+
80+
### Indented
81+
82+
**Status:** differences_found
83+
84+
#### P2: Modifier Differences
85+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
86+
- Root `pf-m-indented` modifier matches correctly.
87+
88+
#### P4: Icon Differences
89+
- Same as Basic: PF viewBox `0 0 20 20`, PFJ viewBox `0 0 32 32`.
90+
91+
#### P5: Cosmetic Differences
92+
- PF demo shows expanded state (`pf-m-expanded`) with a checkbox to toggle `displaySize`. PFJ shows collapsed state without checkbox. This is a showcase layout difference only.
93+
94+
### With custom toggle content
95+
96+
**Status:** differences_found
97+
98+
#### P2: Modifier Differences
99+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
100+
101+
#### P4: Icon Differences
102+
- Toggle icon: PF viewBox `0 0 20 20`, PFJ viewBox `0 0 32 32`.
103+
- Check-circle icon inside toggle content: Both use viewBox `0 0 32 32` — OK.
104+
- Badge `pf-v6-c-badge pf-m-read` — matches correctly.
105+
106+
#### P5: Cosmetic Differences
107+
- PF wraps in `pf-v6-l-stack` with an accessibility note section. PFJ shows only the expandable section without the note. This is showcase layout only.
108+
109+
### Truncate
110+
111+
**Status:** differences_found
112+
113+
#### P2: Modifier Differences
114+
- Same as Basic: PFJ button has extra `pf-v6-c-expandable-section__toggle` class.
115+
- PFJ root has extra `pf-m-expand-top` modifier not present in PF. PF achieves content-first order through DOM ordering alone.
116+
- Button `pf-m-inline pf-m-link` modifiers match correctly.
117+
118+
## Action Items
119+
120+
1. **[P1] Add section: Uncontrolled** — PF has an "Uncontrolled" demo showing controlled state management. Add equivalent PFJ demo or document why it's not applicable.
121+
2. **[P1] Add section: Uncontrolled with dynamic toggle content (function)** — PF shows a `toggleContent` function that receives expanded state and returns dynamic JSX. Evaluate whether PFJ needs an equivalent callback-based API for dynamic toggle content.
122+
3. **[P1] Add section: With heading semantics** — PF uses `toggleWrapper` prop to wrap the toggle button in a heading element (h1-h6) for document structure. PFJ should support this for accessibility.
123+
4. **[P2] Fix toggle button class** — PFJ button has extra `pf-v6-c-expandable-section__toggle` class. PF only applies this class to the wrapper `<div>`, not the `<button>` itself. Remove the extra class from the button element. Affects all sections.
124+
5. **[P2] Fix truncate modifier** — PFJ truncate adds `pf-m-expand-top` on the root element. PF truncate does not use this modifier. Remove it if not required by CSS.
125+
6. **[P4] Fix toggle icon** — PFJ uses caret-right (viewBox `0 0 32 32`) while PF uses chevron-down (viewBox `0 0 20 20`). This reflects a Red Hat vs FontAwesome icon set difference. Affects all sections with toggle icons.

‎showcase/package.json‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
{
2+
"name": "patternfly-java-showcase",
3+
"packageManager": "pnpm@11.10.0",
4+
"private": true,
5+
"scripts": {
6+
"audit:fix": "node audit.mjs",
7+
"code": "node code.mjs",
8+
"http-server": "http-server target/showcase --ssl --cert cert.pem",
9+
"images:clean": "rm -rf src/web/images/*",
10+
"images:download": "node images.mjs",
11+
"markdown": "node markdown.mjs",
12+
"prod": "vite build",
13+
"watch": "vite"
14+
},
215
"dependencies": {
316
"@github/relative-time-element": "^5.2.0",
417
"@patternfly/patternfly": "^6.6.0"
@@ -18,18 +31,5 @@
1831
"unified": "^11.0.5",
1932
"vite": "^8.1.3",
2033
"yaml": "^2.9.0"
21-
},
22-
"name": "patternfly-java-showcase",
23-
"packageManager": "pnpm@11.10.0",
24-
"private": true,
25-
"scripts": {
26-
"audit:fix": "node audit.mjs",
27-
"code": "node code.mjs",
28-
"http-server": "http-server target/showcase --ssl --cert cert.pem",
29-
"images:clean": "rm -rf src/web/images/*",
30-
"images:download": "node images.mjs",
31-
"markdown": "node markdown.mjs",
32-
"prod": "vite build",
33-
"watch": "vite"
3434
}
3535
}

‎showcase/pnpm-lock.yaml‎

Lines changed: 12 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎showcase/pnpm-workspace.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ auditConfig:
111111
- GHSA-vxr8-fq34-vvx9
112112
- GHSA-x4vx-rjvf-j5p4
113113

114+
# @patternfly/documentation-framework declares peer dependencies on React packages
115+
# that we don't use — we only import CSS files from it.
116+
peerDependencyRules:
117+
allowAny:
118+
- '@patternfly/react-code-editor'
119+
- '@patternfly/react-core'
120+
- '@patternfly/react-icons'
121+
- '@patternfly/react-table'
122+
114123
overrides:
115124
'@babel/core@<=7.29.0': '>=7.29.1'
116125
axios@>=1.0.0 <1.15.1: '>=1.15.1'

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL