Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button-label { | ||
| gap: 12px; |
There was a problem hiding this comment.
I decided to use the same value that ionic uses.
| <div class="alert-button-inner"> | ||
| <div class="alert-checkbox-icon"> | ||
| <div class="alert-checkbox-inner"></div> | ||
| {inputs.map((i) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| <div class="alert-button-inner"> | ||
| <div class="alert-radio-icon"> | ||
| <div class="alert-radio-inner"></div> | ||
| {inputs.map((i) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| */ | ||
| this.closeModal(); | ||
| } | ||
| {this.options.map((option, index) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| onIonChange={(ev) => { | ||
| this.setChecked(ev); | ||
| this.callOptionHandler(ev); | ||
| return this.options.map((option, index) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| /** | ||
| * Text that is placed underneath the option text to provide additional details about the option. | ||
| */ | ||
| @Prop() description?: string; |
There was a problem hiding this comment.
Description isn't being used here to display on the screen because ion-select-option isn't used to display the options, it's done through the respective interface. So description is passed to the interface.
| <slot name="start"></slot> | ||
| <slot></slot> | ||
| <slot name="end"></slot> |
There was a problem hiding this comment.
Slots aren't being used here to display on the screen because ion-select-option isn't used to display the options, it's done through the respective interface. So slots are passed to the interface and the rendering is done with a new utility.
Even though it's not used to display here, it's still useful to include here so the docs can generate that "slots" are available for the options.
There was a problem hiding this comment.
Adding the slots here isn't what generates the docs. You need to add this to the component:
ionic-framework/core/src/components/item/item.tsx
Lines 16 to 18 in 0db5b40
| onIonChange={(ev) => { | ||
| this.setChecked(ev); | ||
| this.callOptionHandler(ev); | ||
| return options.map((option, index) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| */ | ||
| this.dismissParentPopover(); | ||
| } | ||
| {options.map((option, index) => { |
There was a problem hiding this comment.
The only change is the addition of optionLabelOptions and renderOptionLabel
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button-label { | ||
| gap: 12px; |
There was a problem hiding this comment.
Based it off ionic theme
ShaneK
left a comment
There was a problem hiding this comment.
Looks good to me! I consider these comments to be optional side quests (nits), feel free to disregard
|
|
||
| import { sanitizeDOMString } from './sanitization'; | ||
|
|
||
| interface RichContentOption { |
There was a problem hiding this comment.
RichContentOption is declared here with id, label, startContent, endContent, description, and a separate RichContentOption in select-interface.ts has only the three content fields. Same name, different shape, no shared source. Could we export one from select-interface.ts and import it here so we can avoid drift?
| <ion-select id="alert-select" label="Alert" placeholder="Select one" interface="alert"> | ||
| <ion-select-option value="full" description="Choose me!"> | ||
| <ion-badge slot="end">NEW</ion-badge> | ||
| <ion-avatar id="avatar" slot="start" size="large"> |
There was a problem hiding this comment.
id="avatar" is repeated 35+ times on this page (lines 60, 67, 74, etc.) Duplicate IDs are invalid HTML and none of the tests query by this id. Can we drop the attribute? I assume it's just copy pasta at this point
|
|
||
| // Render simple string label if there is no rich content to display | ||
| if (!hasRichContent && (typeof label === 'string' || !label)) { | ||
| // const Tag = useSpan ? 'span' : 'div'; |
There was a problem hiding this comment.
Dead commented line, Tag is already declared at line 84. Can you drop this?
There was a problem hiding this comment.
In the ionic theme, when you open and close the modal from the icon it scrolls to the bottom of the view and also the focus indicator is cut off:
bug-with-select-multiple.mov
This does not happen for:
- The single value modal example
- The ios theme
- The md theme
- The overflowing or multiple basic select test on
next- However, the focus indicator issue is there on the multiple example
Note: I didn't test if this exact test has the issue on next since this test is new.
There was a problem hiding this comment.
I was not able to replicate either issues on Chrome and Firefox. What are the steps you took?
There was a problem hiding this comment.
Can we add screenshot tests for this? We need to check the visual rendering as well.
There was a problem hiding this comment.
The reason that I didn't create screenshots for this is because the content for the options are based on the project so they're not fixed. Would it be beneficial to create screenshots for something like that?
There was a problem hiding this comment.
That isn't part of the scope in my opinion. The ticket is meant to add HTML content to the options.
| <slot name="start"></slot> | ||
| <slot></slot> | ||
| <slot name="end"></slot> |
There was a problem hiding this comment.
Adding the slots here isn't what generates the docs. You need to add this to the component:
ionic-framework/core/src/components/item/item.tsx
Lines 16 to 18 in 0db5b40
| return container; | ||
| }; | ||
|
|
||
| const getOptionDefaultSlot = (option: HTMLIonSelectOptionElement): Node[] | null => { |
There was a problem hiding this comment.
Can we add a comment describing this function since the others have comments?
|
|
||
| import { sanitizeDOMString } from './sanitization'; | ||
|
|
||
| interface RichContentOption extends RichContentOpt { |
There was a problem hiding this comment.
Why did we redefine this here instead of adding those properties to select-interface?
There was a problem hiding this comment.
I wanted the types to be strict.
| * @param useSpan - Whether to use a span element instead of a div for the wrapper. | ||
| */ | ||
| const renderClonedContent = (id: string, content: HTMLElement, className: string, useSpan = false) => { | ||
| const Tag = useSpan ? 'span' : 'div'; |
There was a problem hiding this comment.
I understand why the span is required, but why do we ever need to render as a div?
There was a problem hiding this comment.
It's based on the flow of the interface. When it comes to action sheet, that is using buttons to render the option so we should be using span. The other interfaces are using divs to render the option. So in order to be consistent with the flow, I have it using a div.
| ): HTMLElement | string | undefined => { | ||
| const { id, label, startContent, endContent, description } = option; | ||
| const hasRichContent = !!startContent || !!endContent || !!description; | ||
| const Tag = useSpan ? 'span' : 'div'; |
There was a problem hiding this comment.
I understand why the span is required, but why do we ever need to render as a div?
There was a problem hiding this comment.
The avatar size in md theme is way too large. Can we decrease it here to match the other themes?
There was a problem hiding this comment.
I would prefer to not modify the width since we'll eventually add sizes to native avatar and we can adjust it at that point. Let me know if you would still prefer to make the change now.





Issue number: resolves #29890
What is the current behavior?
Select only allows plain text to be passed within it's options.
What is the new behavior?
ion-select-optioninnerHTMLTemplatesEnabledistruestartandendnamed slots for content that appears in the overlay interface but not in the selected textdescriptionprop for text rendered below the option label in the overlayion-selectstart/endslot contentaria-labelderives plain text only from the default slot, ensuring screen readers don't read slotted or element content--select-text-media-width,--select-text-media-height, etc.)Overlay interfaces (
alert,action-sheet,select-popover,select-modal)start,end,description, HTML label) consistently via the sharedrenderOptionLabelutilityActionSheetButton,AlertInput,SelectPopoverOption,SelectModalOption) are unchanged — rich content fields are on internal extended interfaces (SelectActionSheetButton,SelectAlertInput,SelectOverlayOption)sanitizeDOMStringbefore DOM injection to prevent XSSUtilities
select-option-render.tsx: shared render utility for option labels across all overlay componentsgetOptionContent: extracts and clones slot content fromion-select-optionfor overlays and selected textgetDefaultSlotPlainText— extracts plain text from the default slot, used for labels and ariaTests
Does this introduce a breaking change?
No, developers will be able to continue using plain text for select options as usual.
Other information
Preview