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/remove file #2018

Merged
merged 10 commits into from
Jun 20, 2023
Merged

Fix/remove file #2018

merged 10 commits into from
Jun 20, 2023

Conversation

DannyMoerkerke
Copy link
Collaborator

What I did

  1. lion-selected-filelist: restored composed: true and bubbles: true for 'file-remove-requested' event, otherwise removing files for subclassers won't work

…e for 'file-remove-requested' event, otherwise removing files for subclassers won't work
…e for 'file-remove-requested' event, otherwise removing files for subclassers won't work
@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2023

🦋 Changeset detected

Latest commit: bee1169

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lion/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tlouisse
Copy link
Member

tlouisse commented Jun 20, 2023

Yeah, noticed this before as well. Would be nice if there was a faling test for this.

I don't think it's a good idea to leak private events, though.

We could replace this:

with:

get _fileListNode() {
  return Array.from(this.children).filter(child => child.slot === 'selected-file-list');
}

connectedCallback() {
  super.connectedCallback();
  
  // ...
  
  this._fileListNode.addEventListener(
    'file-remove-requested',
     /** @type {EventListener} */ (this._onRemoveFile),
  );
}

// and remove on disconnected

The event then only needs to communicate with its parent without "polluting" the rest of the dom tree.

@DannyMoerkerke
Copy link
Collaborator Author

This still doesn't work without composed: true and bubbles: true. We could add event.stopPropagation to prevent it from bubbling up further.

@DannyMoerkerke DannyMoerkerke merged commit 259e0dd into master Jun 20, 2023
@DannyMoerkerke DannyMoerkerke deleted the fix/remove-file branch June 20, 2023 15:32
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.

2 participants