Replace js message with webcomponents

Created on 24 September 2024, 6 months ago

Problem/Motivation

Follow up from 📌 Add js message theme override to match Umami message markup Needs review to discuss/possibly implement js messages in Umami with web components

Steps to reproduce

N/A

Proposed resolution

TBD

Remaining tasks

Discuss
Agree on appraoch
Implement
Review

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

📌 Task
Status

Active

Version

11.0 🔥

Component

Umami demo

Created by

🇺🇸United States smustgrave

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @smustgrave
  • 🇺🇸United States smustgrave

    Only tagged for that as there was some discussion to still be had it seemed from the original issue.

  • Merge request !9819Webcomponent messages - #3476471 → (Closed) created by finnsky
  • 🇷🇸Serbia finnsky

    Recreated MR ro review this as Webcomponent only, without previous context.

  • Pipeline finished with Failed
    6 months ago
    Total: 212s
    #306874
  • Pipeline finished with Success
    6 months ago
    Total: 2789s
    #306884
  • 🇮🇪Ireland markconroy

    I'm happy with this so. Let's RTBC.

    ---
    Thanks to The Confident for sponsoring my time to work on this.

  • 🇬🇧United Kingdom catch

    Have either of you looked at 🐛 AJAX MessageCommand markup and styling differs from Theme default Active which is trying to do this generically?

  • 🇷🇸Serbia finnsky

    @catch.

    Pushing it to core will be long and complicated. In same time Umami is experimental. Let's do it here and link it in that issue?

  • 🇮🇪Ireland markconroy

    I agree with @finnsky. Let's do it here for Umami.

    We can see how it fares and remove it when the generic version is ready, while also using our version of it as a testing ground.

  • 🇷🇸Serbia finnsky

    Moreover, it seems to me that here we do it much more elegantly than in the attached task. Using progressive but at the same time already well-documented technology.
    https://developer.mozilla.org/en-US/docs/Web/API/Web_components

    So after testing here, in my opinion, we should move this to the core in linked task

  • 🇫🇷France nod_ Lille

    Web components, +1 I don't think there is any concerns with using that in core beside the naming convention. For Shadow Dom (and especially declarative shadow dom) it's less clear. There are two topics

    1. style isolation and how much harder will it be to change from contrib/projects?
    2. Slots, the concept is great but it does come with potential issues

    To elaborate on #2, when you have

    <template id="umami-messages-template">
      <h2 class="heading">
        <slot name="title"></slot>
      </h2>
    </template>
    
    <!-- then -->
    
    <umami-messages-component>
     <span slot="title">Something</span>
    </umami-messages-component>
     
    

    Accessibility picks up the h2, but it doesn't seem that you can access it from the JS. Just need to make sure we're all fine with that.

    it's late so wrapping up here for today

  • 🇺🇸United States shaal Boca Raton, FL

    To allow styling specific sections in shadow dom, we can always use ::part() https://developer.mozilla.org/en-US/docs/Web/CSS/::part

    I did not understand what was the potential issue with Slots / h2 / accessibility. Can you please try explain it again?

  • 🇫🇷France nod_ Lille

    will come back with more later today/tomorrow but there are still feedbak in the MR to address

  • Pipeline finished with Failed
    6 months ago
    Total: 325s
    #310231
  • 🇷🇸Serbia finnsky

    Sending to review. Plus a11y tag.

    On my side axe report is fine with message on page.

  • Pipeline finished with Success
    6 months ago
    Total: 396s
    #310263
  • 🇷🇸Serbia finnsky

    I've added fix but i don't really like it. I would better avoid changes on core level in this MR. We can do this fix later. When we get more info

  • Pipeline finished with Success
    6 months ago
    Total: 548s
    #310958
  • Pipeline finished with Canceled
    5 months ago
    Total: 189s
    #325723
  • 🇷🇸Serbia finnsky

    Reverted last commit

  • Pipeline finished with Success
    5 months ago
    Total: 5475s
    #325727
  • Pipeline finished with Failed
    4 months ago
    Total: 701s
    #343489
  • Status changed to Needs work 2 months ago
  • 🇫🇷France nod_ Lille

    The code itself looks good. It's nicer to use slots than mess with theme functions. I'm still on the fence adding shadow dom on a custom core element.

    Given the fact that it's an experimental theme that we'll retire at some point, why not. I would like to have a disclaimer somewhere in the code (a twig comment above the <template> element maybe?) saying that this is a test, not a guideline on how to use template/shadow dom in Drupal. We haven't talked through all the topics (how/where do we document the slots, js required, style duplication, different styling methods, etc.) hence the disclaimer. Most of the topics would need to have an answer or general agreement before we use this in non experimental parts of core. in the spirit of getting things going I'm ok with committing this

    NW for the disclaimer comment

  • Pipeline finished with Success
    2 months ago
    Total: 567s
    #409741
  • Pipeline finished with Success
    2 months ago
    Total: 368s
    #409760
  • 🇷🇸Serbia finnsky

    Thank you for review.

    I added a disclaimer. Not sure what form it should take. But I tried to be formal and bureaucratic :)

    Please take a look!

  • Pipeline finished with Failed
    2 months ago
    Total: 394s
    #409763
  • Pipeline finished with Success
    2 months ago
    Total: 2622s
    #409992
  • Pipeline finished with Failed
    about 2 months ago
    Total: 585s
    #412651
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 92s
    #412661
  • Pipeline finished with Failed
    about 2 months ago
    Total: 566s
    #412662
  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts

    +1 to Pam’s content suggestion.

  • First commit to issue fork.
  • Pipeline finished with Failed
    about 2 months ago
    Total: 496s
    #412983
  • 🇫🇷France nod_ Lille

    thanks @quietone and @pameeela!

  • 🇬🇧United Kingdom catch

    Disclaimer looks good to me too. If we standardize this in 🐛 AJAX MessageCommand markup and styling differs from Theme default Active or a similar issue we can update the Umami one to be inline and remove the disclaimer again (or still keep it there if we want).

  • 🇷🇸Serbia finnsky

    finnsky changed the visibility of the branch 3476471-replace-js-and to hidden.

  • 🇷🇸Serbia finnsky

    finnsky changed the visibility of the branch 3476471-replace-js-and to active.

  • Pipeline finished with Success
    about 2 months ago
    Total: 689s
    #413703
  • 🇺🇸United States smustgrave

    Fixed up the IS a little bit and resolved the threads

    Applying the patch and doing a fresh install.

    MR applied but did get

    test.patch:169: trailing whitespace.
    Umami uses a web component for rendering messages. The component is
    test.patch:170: trailing whitespace.
    ““.
    test.patch:171: trailing whitespace.
    test.patch:172: trailing whitespace.
    This implementation is a trial only and should not be used on production
    warning: 4 lines add whitespace errors.

    So think those need to be fixed. Fine to self RTBC after

    If you are another contributor eager to jump in, please allow the previous poster at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • Pipeline finished with Failed
    about 2 months ago
    Total: 372s
    #422481
  • First commit to issue fork.
  • Pipeline finished with Success
    about 2 months ago
    Total: 938s
    #422688
  • 🇬🇧United Kingdom oily Greater London

    @smustgrave I think I may have jumped in. I saw #34 'done' so checked and saw one failing test. Wasnt sure it was a random failure but since just experienced a single random failure in another issue, re-ran and it passed. So ran 'test-only' test. It passes. Since there is test coverage in the MR, that should not happen? So 'needs work' to make the test effective?

    Perhaps I should have commented to @finnsky to carry out these steps? But from experience explaining the test-only test, why to run it, how to run it etc. seems so much harder than just running it and then explaining what the result means..

    • nod_ committed 70b2d5ef on 11.x
      Issue #3476471 by finnsky, oily, quietone, smustgrave, nod_, markconroy...
  • 🇫🇷France nod_ Lille

    Committed 70b2d5e and pushed to 11.x. Thanks!

  • 🇷🇸Serbia finnsky

    Great news! Thank you!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024