Skip to content

Conversation

@GrabowskiM
Copy link
Contributor

@GrabowskiM GrabowskiM requested review from a team, Copilot and mikadamczyk October 23, 2025 15:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements an AltRadio List Field component, introducing new functionality for rendering and managing lists of alternative radio button inputs with their associated TypeScript behavior.

Key Changes:

  • Added backend PHP component class and Twig template for AltRadio list fields
  • Implemented TypeScript class to manage AltRadio list field interactions
  • Updated initialization code to support the new component

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/Twig/Components/AltRadio/ListField.php Defines the PHP component class for AltRadio list fields with configuration
src/bundle/Resources/views/themes/standard/design_system/components/alt_radio/list_field.html.twig Twig template for rendering the AltRadio list field component
src/bundle/Resources/views/themes/standard/design_system/components/alt_radio/input.html.twig Updated radio input template to support custom initialization and name attribute
src/bundle/Resources/public/ts/init_components.ts Updated component initialization to include AltRadio list fields
src/bundle/Resources/public/ts/components/alt_radio/index.ts Exports the new AltRadiosListField class
src/bundle/Resources/public/ts/components/alt_radio/alt_radios_list_field.ts TypeScript implementation for managing AltRadio list field behavior
src/bundle/Resources/public/ts/components/alt_radio/alt_radio_input.ts Enhanced radio input class to support list field integration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


setError(value: boolean) {
this._tileElement.classList.toggle('ids-alt-radio__tile--error', value);
this.tileElement.classList.toggle('ids-alt-radio_tile--error', value);
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Corrected class name from 'ids-alt-radio_tile--error' to 'ids-alt-radio__tile--error' for BEM naming consistency (should use double underscore).

Suggested change
this.tileElement.classList.toggle('ids-alt-radio_tile--error', value);
this.tileElement.classList.toggle('ids-alt-radio__tile--error', value);

Copilot uses AI. Check for mistakes.
@GrabowskiM GrabowskiM force-pushed the IBX-10850-alt-radio-list-field branch from 2cba38f to f6fd6d6 Compare October 30, 2025 10:48
@mikadamczyk mikadamczyk requested a review from Copilot October 30, 2025 12:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


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

Comment on lines +55 to +58
if (!(event.target instanceof HTMLDivElement)) {
return;
}

Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

The type check is too restrictive. The event target could be any element within the tile (like text nodes or other HTML elements), not just HTMLDivElement. This will prevent clicks on child elements from working properly.

Suggested change
if (!(event.target instanceof HTMLDivElement)) {
return;
}
// Allow clicks from any element within the tile, not just HTMLDivElement

Copilot uses AI. Check for mistakes.
detail: itemValue,
});

const currentValueInstance = this.itemsMap.get(this.value ?? '');
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Using empty string as fallback for undefined value could cause issues if there's an actual item with an empty string ID. Consider using a different approach or ensuring empty string IDs are not valid.

Suggested change
const currentValueInstance = this.itemsMap.get(this.value ?? '');
let currentValueInstance: AltRadioInput | undefined;
if (this.value !== undefined) {
currentValueInstance = this.itemsMap.get(this.value);
}

Copilot uses AI. Check for mistakes.
currentValueInstance.toggleChecked(false);
}

const nextValueInstance = this.itemsMap.get(itemValue);
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Using empty string as fallback for undefined value could cause issues if there's an actual item with an empty string ID. Consider using a different approach or ensuring empty string IDs are not valid.

Copilot uses AI. Check for mistakes.
@adamwojs
Copy link
Member

adamwojs commented Nov 4, 2025

@GrabowskiM / @mikadamczyk Rebase is needed here

@mikadamczyk mikadamczyk force-pushed the IBX-10850-alt-radio-list-field branch from 877c02c to 12a381f Compare November 4, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants