Skip to content

PrimaryButtonDecorator: Only mark a single button primary#389

Merged
nilmerg merged 1 commit into
mainfrom
fix/primary-button-decorator-should-mark-the-first-button-by-default-only-388
Jun 16, 2026
Merged

PrimaryButtonDecorator: Only mark a single button primary#389
nilmerg merged 1 commit into
mainfrom
fix/primary-button-decorator-should-mark-the-first-button-by-default-only-388

Conversation

@nilmerg

@nilmerg nilmerg commented Jun 15, 2026

Copy link
Copy Markdown
Member

It applies now only to implementations of \ipl\Html\Form. But the reality was that it previoulsy relied on \ipl\Html\Contract\FormElements instead which the method's interface didn't guarantee either.

closes #388

@nilmerg nilmerg added this to the 0.14.0 milestone Jun 15, 2026
@nilmerg nilmerg requested a review from sukhwinder33445 June 15, 2026 14:07
@nilmerg nilmerg self-assigned this Jun 15, 2026
@cla-bot cla-bot Bot added the cla/signed label Jun 15, 2026
Comment thread src/Compat/FormDecorator/PrimaryButtonDecorator.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts PrimaryButtonDecorator behavior so it only marks the form’s configured submit button as primary (instead of marking every submit button), aligning the decorator with how \ipl\Html\Form::setSubmitButton() is intended to define the “primary” submit action.

Changes:

  • Update PrimaryButtonDecorator to only add btn-primary to the submit button returned by \ipl\Html\Form::getSubmitButton().
  • Update and extend the unit tests to cover default behavior (first submit button) and explicitly selected submit button behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/Compat/FormDecorator/PrimaryButtonDecoratorTest.php Updates expectations and adds coverage for default vs explicitly set submit button primary selection.
src/Compat/FormDecorator/PrimaryButtonDecorator.php Changes decoration logic to only mark the configured submit button as primary (for \ipl\Html\Form instances).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Compat/FormDecorator/PrimaryButtonDecorator.php
It applies now only to implementations of `\ipl\Html\Form`.
But the reality was that it previoulsy relied on
`\ipl\Html\Contract\FormElements` instead which the method's
interface didn't guarantee either.

closes #388
@nilmerg nilmerg force-pushed the fix/primary-button-decorator-should-mark-the-first-button-by-default-only-388 branch from f6b4abb to 2d89d09 Compare June 16, 2026 06:41
@nilmerg nilmerg requested a review from sukhwinder33445 June 16, 2026 06:41
@nilmerg nilmerg merged commit 5d74f2d into main Jun 16, 2026
14 checks passed
@nilmerg nilmerg deleted the fix/primary-button-decorator-should-mark-the-first-button-by-default-only-388 branch June 16, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PrimaryButtonDecorator should not mark every submit button primary by default

3 participants