-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fix(labels): prevent clicking a label from triggering onClick twice on several components #30384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4f5cd5e
fix(inputs): fixing issue on several input types (checkbox, select, t…
ShaneK 6c374c9
Merge branch 'main' of github.com:ionic-team/ionic-framework into FW-…
ShaneK 9a9d32e
fix(lint): ran lint fix
ShaneK dbc2f10
fix(textarea): fixing test
ShaneK 47aab6c
fix(input): fixing issue where clicking on the input wrapper would tr…
ShaneK 877eecd
Update core/src/components/textarea/test/basic/textarea.e2e.ts
ShaneK 42d5f36
Update core/src/components/input/test/basic/input.e2e.ts
ShaneK d5a0971
Update core/src/components/select/test/basic/select.e2e.ts
ShaneK f5c4761
fix(input): fixing automated test that verified wrapper click issue
ShaneK 3ad1959
Update checkbox.e2e.ts
ShaneK c6cec21
Update toggle.e2e.ts
ShaneK 0ee30b0
Update core/src/components/checkbox/test/basic/checkbox.e2e.ts
ShaneK 7bf1445
Update core/src/components/select/test/basic/select.e2e.ts
ShaneK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { expect } from '@playwright/test'; | ||
import { configs, test } from '@utils/test/playwright'; | ||
|
||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => { | ||
test.describe(title('textarea: click'), () => { | ||
test('should trigger onclick only once when clicking the label', async ({ page }, testInfo) => { | ||
testInfo.annotations.push({ | ||
type: 'issue', | ||
description: 'https://github.com/ionic-team/ionic-framework/issues/30165', | ||
}); | ||
// Create a spy function in page context | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await page.setContent(`<ion-textarea label="Textarea"></ion-textarea>`, config); | ||
|
||
// Track calls to the exposed function | ||
const clickEvent = await page.spyOnEvent('click'); | ||
const input = page.locator('label.textarea-wrapper'); | ||
|
||
// Use position to make sure we click into the label enough to trigger | ||
// what would be the double click | ||
await input.click({ | ||
position: { | ||
x: 5, | ||
y: 5, | ||
}, | ||
}); | ||
|
||
// Verify the click was triggered exactly once | ||
expect(clickEvent).toHaveReceivedEventTimes(1); | ||
|
||
// Verify that the event target is the checkbox and not the item | ||
const event = clickEvent.events[0]; | ||
expect((event.target as HTMLElement).tagName.toLowerCase()).toBe('ion-textarea'); | ||
}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect } from '@playwright/test'; | ||
import { configs, test } from '@utils/test/playwright'; | ||
|
||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => { | ||
test.describe(title('toggle: click'), () => { | ||
test('should trigger onclick only once when clicking the label', async ({ page }, testInfo) => { | ||
testInfo.annotations.push({ | ||
type: 'issue', | ||
description: 'https://github.com/ionic-team/ionic-framework/issues/30165', | ||
}); | ||
|
||
// Create a spy function in page context | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await page.setContent(`<ion-toggle onclick="console.log('click called')">my label</ion-toggle>`, config); | ||
|
||
// Track calls to the exposed function | ||
let clickCount = 0; | ||
page.on('console', (msg) => { | ||
if (msg.text().includes('click called')) { | ||
clickCount++; | ||
} | ||
}); | ||
|
||
const input = page.locator('div.label-text-wrapper'); | ||
|
||
// Use position to make sure we click into the label enough to trigger | ||
// what would be the double click | ||
await input.click({ | ||
position: { | ||
x: 5, | ||
y: 5, | ||
}, | ||
}); | ||
|
||
// Verify the click was triggered exactly once | ||
expect(clickCount).toBe(1); | ||
}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.