Skip to content
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

fix(popover): use composed path for trigger element target (#24531) #24535

Closed
wants to merge 1 commit into from

Conversation

mixalbl4-127
Copy link

@mixalbl4-127 mixalbl4-127 commented Jan 8, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: #24531, #24415

What is the new behavior?

image

Does this introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Thanks for making this PR! I added a small comment, but this is looking great otherwise. Could we also add a visual regression test? You should be able to use a test in https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/datetime/test/basic/e2e.ts as a basis for the new one. We would probably want to a test that opens datetime in a popover, opens the time picker, and takes a screenshot. That way if the positioning ever regresses we can catch it.

@@ -372,7 +372,7 @@ export class Popover implements ComponentInterface, PopoverInterface {
* was dispatched.
*/
@Method()
async present(event?: MouseEvent | TouchEvent | PointerEvent): Promise<void> {
async present(event?: MouseEvent | TouchEvent | PointerEvent | Omit<MouseEvent, 'detail'> & { detail: { ionShadowTarget: EventTarget | null; } }): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than hack the MouseEvent type, It might make more sense to use CustomEvent since it has detail built in.

Suggested change
async present(event?: MouseEvent | TouchEvent | PointerEvent | Omit<MouseEvent, 'detail'> & { detail: { ionShadowTarget: EventTarget | null; } }): Promise<void> {
async present(event?: MouseEvent | TouchEvent | PointerEvent | CustomEvent): Promise<void> {

And then in your datetime.tsx, you can do something like:

const customEvent = new CustomEvent('ionShadowTarget', { detail: { ionShadowTarget: ev.target }});
popoverRef.present(customEvent);

Maybe not the most elegant, but ionShadowTarget is a private API, so we can easily change this if needed.

@mixalbl4-127
Copy link
Author

if I uderstand correct, screenshoots are locate in remote server https://screenshot.ionicframework.com/ and I cant push new screenshoot here.
No faq like "how to upload new screenshoot for new test" here https://ionicframework.com/docs/contributing/how-to-contribute#screenshot-tests

A lot of fail tests now:
image

@sean-perkins
Copy link
Contributor

if I uderstand correct, screenshoots are locate in remote server https://screenshot.ionicframework.com/ and I cant push new screenshoot here. No faq like "how to upload new screenshoot for new test" here https://ionicframework.com/docs/contributing/how-to-contribute#screenshot-tests

A lot of fail tests now: image

Hello @mixalbl4-127,

You can see an example of what a screenshot test would look like here: https://github.com/ionic-team/ionic-framework/pull/24616/files#diff-46e1092227a42bc4ac87aadc41a0972deca18562fbb5b4d69b906a96f72e79a8R1. While screenshots are hosted, new tests will upload the new screenshot diffs when they are ran through CI.

I would like to close this PR in favor of #24616. I'd like to give you co-author credit (I'll update the commit signature soon). Your patch was extremely helpful and also uncovered another issue with the popover and pickers, that should be patched together.

Let me know if you have any issues with closing this PR.

@sean-perkins
Copy link
Contributor

Closing this PR now that the other PR is merged. Thank you so much for getting the work started here 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants