Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Best JavaScript Is No JavaScript

Best JavaScript Is No JavaScript

Radoslav Stankov

July 27, 2023
Tweet

More Decks by Radoslav Stankov

Other Decks in Technology

Transcript

  1. <details> <summary>System Requirements</summary> <p> Requires a computer running an operating

    system. The computer must have some memory and ideally some kind of long-term storage. An input device as well as some form of output device is recommended. </p> </details>
  2. @media (max-width: 640px) { .table-component, .table-component thead, .table-component tbody, .table-component

    tfoot, .table-component tr { display: block; } .table-component tbody td { display: fl ex; } .table-component tbody td:not(.actions):before { content: attr(title); fl ex: 0 1 35%; display: block; white-space: nowrap; } }
  3. @media (max-width: 640px) { .table-component, .table-component thead, .table-component tbody, .table-component

    tfoot, .table-component tr { display: block; } .table-component tbody td { display: fl ex; } .table-component tbody td:not(.actions):before { content: attr(title); fl ex: 0 1 35%; display: block; white-space: nowrap; } }
  4. @media (max-width: 640px) { .table-component, .table-component thead, .table-component tbody, .table-component

    tfoot, .table-component tr { display: block; } .table-component tbody td { display: fl ex; } .table-component tbody td:not(.actions):before { content: attr(title); fl ex: 0 1 35%; display: block; white-space: nowrap; } }
  5. @media (max-width: 640px) { .table-component, .table-component thead, .table-component tbody, .table-component

    tfoot, .table-component tr { display: block; } .table-component tbody td { display: fl ex; } .table-component tbody td:not(.actions):before { content: attr(title); fl ex: 0 1 35%; display: block; white-space: nowrap; } }
  6. 1⃣ Accessible 2⃣ Mobile friendly 3⃣ All batteries include 


    ➡ No extra code 🚫 Single date, no range 
 🚫 Style doesn't match our site <input type="date">
  7. 1⃣ Accessible 2⃣ Build-in backdrop 3⃣ Auto handling of forms

    (example: auto-focus) 4⃣ Stops scrolling of back page 5⃣ Auto handle of ESC 6⃣ Style as you wish 🚫 JavaScript to trigger the modal version 
 🚫 JavaScript need to close dialog when click backdrop <dialog>
  8. import { setEventListners } from './utils'; setEventListners(document, { '[data-dialog]:click': (e)

    => { document .getElementById(e.target.closest('[data-dialog]').dataset.dialog) ?.showModal(); }, 'dialog:click': (e) => { if (e.target.tagName === 'DIALOG') { e.target.close(); } }, });