Skip to content

Add Vaadin 25 support while maintaining Vaadin 24 compatibility#27

Open
paodb wants to merge 8 commits intomasterfrom
vaadin-25-support
Open

Add Vaadin 25 support while maintaining Vaadin 24 compatibility#27
paodb wants to merge 8 commits intomasterfrom
vaadin-25-support

Conversation

@paodb
Copy link
Member

@paodb paodb commented Mar 6, 2026

This PR adds Vaadin 25 compatibility while maintaining support for Vaadin 24, along with several refactorings and demo improvements.

Changes:

Vaadin 24 & 25 compatibility

  • Updated JavaScript calls in ReplaceableLoginOverlay and LoginLayout to support both Vaadin 24 and Vaadin 25.
  • Adjusted tests to work with both versions.
  • Added testbench-rpc dependency to retrieve the Vaadin version during tests.

Code improvements

  • Refactored JavaScript snippets to use Java text blocks for improved readability.
  • Moved static methods from ReplaceableLoginOverlay interface into a dedicated utils class.

Demo improvements

  • Added AppShellConfiguratorImpl class.
  • Introduced separate stylesheets for Vaadin 25 compatibility.
  • Used the demo source condition attribute to switch between Vaadin 24 and 25 styles.
  • Added simple change password validation in the demo.

Summary by CodeRabbit

  • New Features

    • Five new customization actions for the login overlay: replace form components, replace header, remove/replace forgot-password, and remove submit button.
  • Improvements

    • Vaadin framework bumped to 25.0.6 for improved compatibility.
    • Centralized compatibility scripts and version-aware runtime/style handling to support Vaadin 24 and 25+.
  • Tests

    • Test-suite updates and new test helpers to detect server version and adjust test behavior.
    • Added a test-scoped utility dependency.

paodb added 4 commits March 3, 2026 17:37
Update JavaScript calls in classes ReplaceableLoginOverlay and LoginLayout to support Vaadin 24 & Vaadin 25.

Close #23
Use demo source condition attribute to select between Vaadin 24 & Vaadin 25 styles.
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Walkthrough

Refactors inline JavaScript for Vaadin login overlay into a new LoginOverlayUtils helper; adds default manipulation methods to ReplaceableLoginOverlay; updates demos, tests and ITs to be Vaadin-version aware (24 vs 25+); introduces RPC test support and a Vaadin‑25-specific demo stylesheet.

Changes

Cohort / File(s) Summary
Build configuration
pom.xml
Added test-scoped com.flowingcode.vaadin.test:testbench-rpc:1.5.0, bumped vaadin.version in profile v25 to 25.0.6, and expanded test-jar/demo-jar exclusions to include AppShellConfiguratorImpl.class.
Overlay JS refactor & API additions
src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java, src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayout.java, src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java
Added package-private LoginOverlayUtils (JS snippet builders) and replaced inline JS usage with its helpers. Added default overlay manipulation methods (e.g., replaceFormComponents, replaceHeaderComponent, removeForgotPassword, replaceForgotPassword, removeSubmitButton).
Demo resource selection
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/ExtendedLoginOverlayDemo.java, src/test/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayoutDemo.java
Added conditional @DemoSource annotations selecting CSS for Vaadin 24 vs Vaadin 25+, wrapped with version condition markers.
Test RPC & AppShell support
src/test/java/com/flowingcode/vaadin/addons/AppShellConfiguratorImpl.java, src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java
Added test AppShellConfiguratorImpl and new public test interface ServerVersionCallables exposing int getMajorVersion() for RPC-based server-version checks.
Test views & helpers
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestExtendedLoginOverlayView.java, src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayout.java, src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayoutView.java
Tests now implement ServerVersionCallables and expose @ClientCallable getMajorVersion(). Added version-guarded CSS imports; TestLoginLayoutView moved password fields to class scope and added onAccept() validation.
Integration tests: version-aware queries
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java, .../ExtendedLoginOverlayIT.java, .../LoginLayoutIT.java
AbstractViewTest implements HasRpcSupport and waits for Vaadin readiness. ITs use Vaadin-25-aware queries (LoginOverlayElement/scoped queries) when server major version ≥25, otherwise retain legacy lookups.
Demo stylesheet (Vaadin 25+)
src/test/resources/META-INF/frontend/styles/extended-login-styles-v25.css
Added Vaadin‑25-specific CSS adjusting brand area, content scaling, and form overflow for demo/test environment.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • mlopezFC
  • javier-godoy
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Vaadin 25 support while maintaining Vaadin 24 compatibility' directly and accurately summarizes the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vaadin-25-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (3)
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java (1)

20-29: Move this contract out of the .it package.

Both TestExtendedLoginOverlayView and TestLoginLayout implement this interface from outside com.flowingcode.vaadin.addons.extendedlogin.it, so the current location makes the server-side fixtures depend on the integration-test namespace. A neutral test-support package would keep that dependency direction cleaner.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java`
around lines 20 - 29, Move the ServerVersionCallables interface out of the
com.flowingcode.vaadin.addons.extendedlogin.it package into a neutral
test-support package (e.g.,
com.flowingcode.vaadin.addons.extendedlogin.testsupport) so integration tests
don't become a dependency target; update the package declaration in the
ServerVersionCallables file and adjust imports in classes that implement it
(TestExtendedLoginOverlayView, TestLoginLayout) to reference the new package
name, and run/compile tests to ensure no remaining references to the old .it
package remain.
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java (1)

57-62: Redundant conditional after assertTrue.

The if (h2exists) block on line 59 is unreachable if h2exists is false because assertTrue on line 58 would already fail the test.

Simplify by removing redundant conditional
     } else {
-      boolean h2exists = vlfw.$(H2Element.class).exists();
-      assertTrue("H2 is not present", h2exists);
-      if (h2exists) {
-        assertEquals("Change Password", vlfw.$(H2Element.class).first().getText());
-      }
+      assertTrue("H2 is not present", vlfw.$(H2Element.class).exists());
+      assertEquals("Change Password", vlfw.$(H2Element.class).first().getText());
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java`
around lines 57 - 62, The test uses a redundant if (h2exists) after
assertTrue("H2 is not present", h2exists) in LoginLayoutIT.java; remove the
conditional and directly call assertEquals("Change Password",
vlfw.$(H2Element.class).first().getText()) after the assertTrue (or replace both
with a single assertEquals if you prefer) so the check of
vlfw.$(H2Element.class).first().getText() is executed only when the existence
assertion has guaranteed the element is present.
src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java (1)

55-78: Potential race condition with sequential asynchronous calls.

replaceHeaderComponent issues two separate executeJs calls, each wrapped in setTimeout by the utility method. Without a guaranteed execution order, the append operation could theoretically execute before the clear operation completes, though in practice browsers typically execute same-tick setTimeout(..., 0) callbacks in order.

Consider combining the operations into a single script to eliminate any timing ambiguity.

Combine clear and append into single script
  default void replaceHeaderComponent(HasElement withElement) {
    getElement().appendChild(withElement.getElement());
-
    this.getElement()
        .executeJs(
            LoginOverlayUtils.getOverlayWrapperScript(
                """
                    var brand = overlayWrapper.shadowRoot ? overlayWrapper.shadowRoot.querySelector('[part="brand"]') : overlayWrapper.querySelector('[part="brand"]');
                    if (brand) {
                      brand.replaceChildren();
-                    }
-                    """));
-
-    this.getElement()
-        .executeJs(
-            LoginOverlayUtils.getOverlayWrapperScript(
-                """
-                    var brand = overlayWrapper.shadowRoot ? overlayWrapper.shadowRoot.querySelector('[part="brand"]') : overlayWrapper.querySelector('[part="brand"]');
-                    if (brand) {
                      brand.appendChild($0);
                    }
                    """),
            withElement);
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`
around lines 55 - 78, The replaceHeaderComponent method issues two separate
executeJs calls which can race; change it to a single executeJs call using
LoginOverlayUtils.getOverlayWrapperScript that runs one script which finds the
[part="brand"], clears its children and then appends $0 in the same tick,
passing withElement as the single argument so both clear-and-append happen
atomically; update the method to remove the two executeJs invocations and use
one combined script invocation referencing withElement.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pom.xml`:
- Around line 467-470: The v25 Maven profile currently sets
<vaadin.version>25.0.6</vaadin.version> but leaves
<jetty.version>11.0.26</jetty.version>, which is incompatible; update the v25
profile to bump the jetty.version property to a Jetty 12.x release (e.g.,
12.1.x) so Jetty supports Jakarta Servlet 6.1+ required by Vaadin 25 — locate
the jetty.version property in the v25 profile and change its value to a 12.1.x
version.

In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java`:
- Around line 61-75: The getFormWrapperScript method fails to traverse the
overlay's shadow DOM when locating the <form>, so update the lookup for the form
on the overlayFormWrapper to check overlayFormWrapper.shadowRoot first (like
getOverlayWrapperScript/getLoginFormWrapperScript): if
overlayFormWrapper.shadowRoot exists, query the form from
overlayFormWrapper.shadowRoot.querySelector('form'), otherwise fall back to
overlayFormWrapper.querySelector('form'), then run the formatted action when
form is found (symbols: getFormWrapperScript, overlayFormWrapper, shadowRoot,
querySelector).

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayout.java`:
- Around line 62-68: The preprocessor comment markers in TestLoginLayout's
getMajorVersion method use a spaced form ("// `#if`" and "// `#endif`") inconsistent
with the rest of the codebase; update the conditional block around the
getMajorVersion method (class TestLoginLayout, method getMajorVersion) to use
the no-space form ("//#if" and "//#endif") so the preprocessor recognizes the
directives consistently.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayoutView.java`:
- Around line 76-83: The onAccept() handler currently treats two empty strings
as a valid password change; update onAccept() to reject blank or whitespace-only
passwords before showing success by ensuring password and confirmPassword are
non-null and not blank (e.g., check password != null &&
!password.trim().isEmpty() and same for confirmPassword) and only then compare
equality (password.equals(confirmPassword)) to show "Password changed."
otherwise show the mismatch/empty error; refer to the onAccept(), password and
confirmPassword variables for locating the change.
- Around line 41-45: The two `@CssImport` annotations in TestLoginLayoutView (the
lines with `@CssImport`("./styles/extended-login-styles.css") and
`@CssImport`("./styles/extended-login-styles-v25.css")) are both compiled because
the //#if comments are not a preprocessing step; remove both annotations and
instead load the appropriate stylesheet at runtime in the view's constructor (or
an init method) by checking the Vaadin version or a config flag and calling
UI.getCurrent().getPage().addStyleSheet(...) or
UI.getCurrent().getElement().executeJs(...) to include the correct CSS file;
this ensures only the version-specific stylesheet is loaded instead of relying
on compile-time comments.

In `@src/test/resources/META-INF/frontend/styles/extended-login-styles-v25.css`:
- Around line 1-20: The CSS license header starts with the unusual "/*-" and
lacks the required whitespace, triggering Stylelint's comment-whitespace-inside
rule for the file extended-login-styles-v25.css; fix by either (A) normalizing
the header comments in that file: change the opening "/*-" to a standard "/*"
and ensure there is a space immediately after "/*" and immediately before the
closing "*/" (so the license block and the "/*Demo styles*/" comment comply), or
(B) add an override in your stylelint config to whitelist this generated license
header by disabling or ignoring comment-whitespace-inside for that file (use an
override for the filename pattern and set the rule to null or exempt the header
pattern).

---

Nitpick comments:
In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`:
- Around line 55-78: The replaceHeaderComponent method issues two separate
executeJs calls which can race; change it to a single executeJs call using
LoginOverlayUtils.getOverlayWrapperScript that runs one script which finds the
[part="brand"], clears its children and then appends $0 in the same tick,
passing withElement as the single argument so both clear-and-append happen
atomically; update the method to remove the two executeJs invocations and use
one combined script invocation referencing withElement.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java`:
- Around line 57-62: The test uses a redundant if (h2exists) after
assertTrue("H2 is not present", h2exists) in LoginLayoutIT.java; remove the
conditional and directly call assertEquals("Change Password",
vlfw.$(H2Element.class).first().getText()) after the assertTrue (or replace both
with a single assertEquals if you prefer) so the check of
vlfw.$(H2Element.class).first().getText() is executed only when the existence
assertion has guaranteed the element is present.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java`:
- Around line 20-29: Move the ServerVersionCallables interface out of the
com.flowingcode.vaadin.addons.extendedlogin.it package into a neutral
test-support package (e.g.,
com.flowingcode.vaadin.addons.extendedlogin.testsupport) so integration tests
don't become a dependency target; update the package declaration in the
ServerVersionCallables file and adjust imports in classes that implement it
(TestExtendedLoginOverlayView, TestLoginLayout) to reference the new package
name, and run/compile tests to ensure no remaining references to the old .it
package remain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33ac540c-6001-4b01-9627-752c3e8dd146

📥 Commits

Reviewing files that changed from the base of the PR and between 7586f5c and 06b372c.

📒 Files selected for processing (15)
  • pom.xml
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayout.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java
  • src/test/java/com/flowingcode/vaadin/addons/AppShellConfiguratorImpl.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/ExtendedLoginOverlayDemo.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayoutDemo.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestExtendedLoginOverlayView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayout.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayoutView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java
  • src/test/resources/META-INF/frontend/styles/extended-login-styles-v25.css

@paodb paodb force-pushed the vaadin-25-support branch from 06b372c to 6a328b6 Compare March 9, 2026 12:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (4)
src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java (1)

58-76: Extract the repeated brand lookup into LoginOverlayUtils.

The same brand-lookup block is duplicated in both JS snippets here. Pulling that into the utility would keep the clear and append paths from drifting apart.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`
around lines 58 - 76, The duplicated brand lookup JS in
ReplaceableLoginOverlay's two getElement().executeJs calls should be moved into
a single reusable helper in LoginOverlayUtils (e.g. a method like
getBrandLookupScript or an overload of getOverlayWrapperScript that injects the
brand variable), then call that helper from both executeJs invocations so each
snippet reuses the same brand lookup variable instead of duplicating the
querySelector logic; update ReplaceableLoginOverlay to invoke
LoginOverlayUtils.getOverlayWrapperScript (or the new helper) for both the clear
and append paths and remove the duplicated brand query blocks.
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java (1)

53-77: Expose the version check from the base test.

$server.getMajorVersion() >= 25 is now repeated in the IT subclasses. A small helper here, e.g. isVaadin25(), would keep the version boundary in one place and simplify the test bodies.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java`
around lines 53 - 77, Add a small helper on AbstractViewTest that centralizes
the Vaadin major-version check: implement a protected boolean isVaadin25() that
returns $server.getMajorVersion() >= 25 (using the existing
ServerVersionCallables $server instance), and update IT subclasses to call
isVaadin25() instead of repeating the literal check so the version boundary is
kept in one place.
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java (1)

64-69: Assert that the original login form is actually replaced.

This only checks that the custom slot="form" content exists. A regression that leaves the stock login form in place would still pass, so add a negative assertion for the original form controls as well.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java`
around lines 64 - 69, Add a negative assertion to ensure the original login form
is removed: after locating the custom slot (divSlotForm / divSlotFormExists)
assert that the original form controls do not exist by querying for the original
FormLayoutElement and its typical child controls and asserting false; for
example use vlfw.$(FormLayoutElement.class).exists() (or
vlfw.$(TextFieldElement.class) / vlfw.$(ButtonElement.class) as appropriate) and
call assertFalse with a clear message so the test fails if the stock login form
is still present.
src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java (1)

52-57: Assert that the built-in forgot-password control is gone.

This proves the custom anchor renders, but it still passes if the original forgot-password control remains alongside it. Adding a negative assertion here would lock in the replacement behavior across both supported versions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java`
around lines 52 - 57, Add a negative assertion in ExtendedLoginOverlayIT to
ensure the original "forgot-password" control is removed: after computing
anchorQuery/anchorExists, query for any AnchorElement that represents the
built-in forgot-password control (e.g., an AnchorElement whose text contains
"Forgot" or "Forgot password") and assertFalse that this query exists; keep the
vaadin25 branching logic consistent when building the query so the absence check
covers both supported versions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`:
- Around line 58-76: The duplicated brand lookup JS in ReplaceableLoginOverlay's
two getElement().executeJs calls should be moved into a single reusable helper
in LoginOverlayUtils (e.g. a method like getBrandLookupScript or an overload of
getOverlayWrapperScript that injects the brand variable), then call that helper
from both executeJs invocations so each snippet reuses the same brand lookup
variable instead of duplicating the querySelector logic; update
ReplaceableLoginOverlay to invoke LoginOverlayUtils.getOverlayWrapperScript (or
the new helper) for both the clear and append paths and remove the duplicated
brand query blocks.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java`:
- Around line 53-77: Add a small helper on AbstractViewTest that centralizes the
Vaadin major-version check: implement a protected boolean isVaadin25() that
returns $server.getMajorVersion() >= 25 (using the existing
ServerVersionCallables $server instance), and update IT subclasses to call
isVaadin25() instead of repeating the literal check so the version boundary is
kept in one place.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java`:
- Around line 52-57: Add a negative assertion in ExtendedLoginOverlayIT to
ensure the original "forgot-password" control is removed: after computing
anchorQuery/anchorExists, query for any AnchorElement that represents the
built-in forgot-password control (e.g., an AnchorElement whose text contains
"Forgot" or "Forgot password") and assertFalse that this query exists; keep the
vaadin25 branching logic consistent when building the query so the absence check
covers both supported versions.

In
`@src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java`:
- Around line 64-69: Add a negative assertion to ensure the original login form
is removed: after locating the custom slot (divSlotForm / divSlotFormExists)
assert that the original form controls do not exist by querying for the original
FormLayoutElement and its typical child controls and asserting false; for
example use vlfw.$(FormLayoutElement.class).exists() (or
vlfw.$(TextFieldElement.class) / vlfw.$(ButtonElement.class) as appropriate) and
call assertFalse with a clear message so the test fails if the stock login form
is still present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 51dafd49-0c4d-4fda-bcd0-cf7afc521138

📥 Commits

Reviewing files that changed from the base of the PR and between 06b372c and 6a328b6.

📒 Files selected for processing (11)
  • pom.xml
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayout.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestExtendedLoginOverlayView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayout.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayoutView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • pom.xml
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayoutView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java

@paodb paodb requested review from javier-godoy and mlopezFC March 9, 2026 13:21
@paodb paodb marked this pull request as ready for review March 9, 2026 13:21
@paodb paodb force-pushed the vaadin-25-support branch from 6a328b6 to 040fdb4 Compare March 9, 2026 15:40
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java (1)

55-78: Consider consolidating duplicate brand selection logic.

The brand element selection logic (overlayWrapper.shadowRoot ? ... : ...) is duplicated across both executeJs calls. While functionally correct, this could be consolidated into a single script for clarity and to avoid potential timing issues between the two async calls.

♻️ Optional: Single script approach
  default void replaceHeaderComponent(HasElement withElement) {
    getElement().appendChild(withElement.getElement());

    this.getElement()
        .executeJs(
            LoginOverlayUtils.getOverlayWrapperScript(
                """
                    var brand = overlayWrapper.shadowRoot ? overlayWrapper.shadowRoot.querySelector('[part="brand"]') : overlayWrapper.querySelector('[part="brand"]');
                    if (brand) {
                      brand.replaceChildren();
-                   }
-                   """));
-
-   this.getElement()
-       .executeJs(
-           LoginOverlayUtils.getOverlayWrapperScript(
-               """
-                   var brand = overlayWrapper.shadowRoot ? overlayWrapper.shadowRoot.querySelector('[part="brand"]') : overlayWrapper.querySelector('[part="brand"]');
-                   if (brand) {
                      brand.appendChild($0);
                    }
                    """),
            withElement);
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`
around lines 55 - 78, Consolidate the duplicated brand selection in
replaceHeaderComponent by using a single executeJs call that obtains the brand
element once (using the existing overlayWrapper.shadowRoot ?
overlayWrapper.shadowRoot.querySelector('[part="brand"]') :
overlayWrapper.querySelector('[part="brand"]')) and then performs both
replaceChildren() and appendChild($0) in that same script; update the call that
currently uses LoginOverlayUtils.getOverlayWrapperScript to execute a combined
script and pass withElement as the argument to appendChild, keeping references
to getElement(), replaceHeaderComponent, and
LoginOverlayUtils.getOverlayWrapperScript to locate where to change the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`:
- Around line 103-114: The removeForgotPassword() call currently runs after
appending the new element and thus removes the element just added; modify
ReplaceableLoginOverlay.replaceForgotPassword(HasElement withElement) to first
call removeForgotPassword(), then set the slot attribute on withElement, then
append withElement via getElement().appendChild(...), and finally invoke
getElement().executeJs(LoginOverlayUtils.getLoginFormWrapperScript(...),
withElement) as before so the wrapper script operates on the newly appended
element.

---

Nitpick comments:
In
`@src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java`:
- Around line 55-78: Consolidate the duplicated brand selection in
replaceHeaderComponent by using a single executeJs call that obtains the brand
element once (using the existing overlayWrapper.shadowRoot ?
overlayWrapper.shadowRoot.querySelector('[part="brand"]') :
overlayWrapper.querySelector('[part="brand"]')) and then performs both
replaceChildren() and appendChild($0) in that same script; update the call that
currently uses LoginOverlayUtils.getOverlayWrapperScript to execute a combined
script and pass withElement as the argument to appendChild, keeping references
to getElement(), replaceHeaderComponent, and
LoginOverlayUtils.getOverlayWrapperScript to locate where to change the code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 592c3bfb-40f1-4072-be16-86a2d5ea3873

📥 Commits

Reviewing files that changed from the base of the PR and between 6a328b6 and 040fdb4.

📒 Files selected for processing (10)
  • pom.xml
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginLayout.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/ReplaceableLoginOverlay.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestExtendedLoginOverlayView.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/TestLoginLayout.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/AbstractViewTest.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/LoginLayoutIT.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ServerVersionCallables.java
  • src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
  • src/test/java/com/flowingcode/vaadin/addons/extendedlogin/it/ExtendedLoginOverlayIT.java
  • pom.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Do

Development

Successfully merging this pull request may close these issues.

2 participants