diff --git a/core/src/components/select/select.tsx b/core/src/components/select/select.tsx
index 54906739099..f727994a9ba 100644
--- a/core/src/components/select/select.tsx
+++ b/core/src/components/select/select.tsx
@@ -686,7 +686,7 @@ const textForValue = (
compareWith?: string | SelectCompareFn | null
): string | null => {
const selectOpt = opts.find((opt) => {
- return compareOptions(getOptionValue(opt), value, compareWith);
+ return compareOptions(value, getOptionValue(opt), compareWith);
});
return selectOpt ? selectOpt.textContent : null;
};
diff --git a/core/src/components/select/test/compare-with/select.e2e.ts b/core/src/components/select/test/compare-with/select.e2e.ts
index 9c2dd556853..f18f0dad746 100644
--- a/core/src/components/select/test/compare-with/select.e2e.ts
+++ b/core/src/components/select/test/compare-with/select.e2e.ts
@@ -21,4 +21,52 @@ test.describe('select: compare-with', () => {
value: '1',
});
});
+
+ test('should work with different parameter types', async ({ page }, testInfo) => {
+ test.skip(testInfo.project.metadata.rtl === true, 'This does not check LTR vs RTL layouts');
+ test.skip(testInfo.project.metadata.mode === 'md', 'This logic is the same across modes');
+ test.info().annotations.push({
+ type: 'issue',
+ description: 'https://github.com/ionic-team/ionic-framework/issues/25759',
+ });
+
+ await page.setContent(`
+
+
+
+ `);
+ const ionAlertDidPresent = await page.spyOnEvent('ionAlertDidPresent');
+
+ const select = page.locator('ion-select');
+ const selectLabel = select.locator('[part="text"]');
+
+ await expect(selectLabel).toHaveText('Option #3');
+
+ await select.click();
+ await ionAlertDidPresent.next();
+
+ const selectRadios = page.locator('ion-alert button.alert-radio');
+ await expect(selectRadios.nth(0)).toHaveAttribute('aria-checked', 'false');
+ await expect(selectRadios.nth(1)).toHaveAttribute('aria-checked', 'false');
+ await expect(selectRadios.nth(2)).toHaveAttribute('aria-checked', 'true');
+ });
});