Share
Embed
Whats New in Web Platform from Google I/O 2022
What’s new in UI / UX
What’s new in Privacy / Security
What’s new in Web App Capabilities
What’s new in JavaScript
Hiren Dave
June 05, 2022
Transcript
37 slides
-
GDG Ahmedabad Agenda • What’s new in UI / UX
• What’s new in Privacy / Security • What’s new in Web App Capabilities • What’s new in JavaScript -
GDG Ahmedabad accent-color css property Customise theme of UI form
controls So far a developer has to rewrite DOM to have different theme for UI controls such as checkbox, radio buttons. Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Samsung browser -
GDG Ahmedabad :root { color-scheme: light dark; accent-color: red; }
input { accent-color: red; } input[type=checkbox] { accent-color: red; } -
GDG Ahmedabad <dialog> element Out of the box modals So
far a developer has to depend on third party libraries for adding modal popups . Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Mobile browsers -
GDG Ahmedabad <dialog class=”my-dialog”> Hello, this is a Modal Popup
</dialog> <script> // Mostly in button click const myDialog = document.querySelector(“.my-dialog”); myDialog.showModal(); </script> -
GDG Ahmedabad datetime-local input New input type to get date
and time So far a developer has to depend on third party libraries adding controls for the date time input. Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Mobile browsers -
GDG Ahmedabad COLRv1 Improved color gradient vector font An evolution
of the COLRv0 font format intended to make color fonts widespread by adding gradients, compositing and blending, and improved internal shape reuse for crisp and compact font files that compress well. Now supported in all major browsers, Chromium, Edge -
GDG Ahmedabad <style> @import url(https://fonts.googleapis.com/css2?family=Noto+Color+Emoji); .emoji { font-family: "Noto Color
Emoji", sans-serif; } </style> <span class="emoji">🙂</span> -
GDG Ahmedabad aspect-ratio Maintain aspect ratio for all the elements
Earlier it was only for images now it’s available for all the elements Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Mobile browsers -
GDG Ahmedabad There is more…. • containment css • img
loading lazy / iframe loading lazy • bfcache • Priority hints fetch priority hints • size-adjust for typography • SIMD • Interaction to next print INP -
Major improvements in privacy & security primitives What’s New In
Privacy & Security -
GDG Ahmedabad CHIPS Cookies having independent partitioned state A partitioned
third-party cookie is tied to the top-level site where it's initially set and cannot be accessed from elsewhere. The aim is to allow cookies to be set by a third-party service, but only read within the context of the top-level site where they were initially set. This is to prevent cross site tracking At experiment stage in, Chromium, -
GDG Ahmedabad Topics API Share relevant topics with privacy Enable
interest-based advertising, without having to resort to tracking the sites a user visits. At experiment stage in, Chromium, -
GDG Ahmedabad // Get the array of top topics for
this user. const topics = await document.browsingTopics(); value: a number identifying the topic in the taxonomy taxonomyVersion: a string identifying the set of topics currently in use by the browser classifierVersion: a string identifying the machine-learning classifier used to infer site topics from hostnames -
Major improvements in web app capabilities What’s New In Web
App Capabilities -
GDG Ahmedabad MediaSession API MediaSession API to control media via
OS and Devices Developers can customize media notifications and playback controls with the Media Session API Now supported in all major browsers, Chromium, Edge, Safari, Samsung browser -
GDG Ahmedabad await document.querySelector("video").play(); if ("mediaSession" in navigator) { navigator.mediaSession.metadata
= new MediaMetadata({ title: 'Album Title', artist: 'Album Artist', album: 'Album name' }); } -
GDG Ahmedabad Windows Control Overlay More control, just like installed
app Developers can put the content in the windows title Now supported in all major browsers, Chromium, Edge -
GDG Ahmedabad Navigation API The makeover of history API Developers
can customize media notifications and playback controls with the Media Session API Now supported in all major browsers, Chromium, Edge -
GDG Ahmedabad navigation.addEventListener('navigate', navigateEvent => { switch (navigateEvent.destination.url) { case
'https://example.com/': navigateEvent.transitionWhile(loadIndexPage()); break; case 'https://example.com/cats': navigateEvent.transitionWhile(loadCatsPage()); break; } }); -
GDG Ahmedabad Virtual Keyboard API Control virtual keyboard Developers can
control virtual keyboard for user text input through styling and scripting Now supported in all major browsers, Chromium, Edge -
GDG Ahmedabad Page transition API Simplified transition between pages Developers
can add smooth animated page transition experience with this API. Now supported in all major browsers, Chromium, Edge -
GDG Ahmedabad There is more… • Color scheme in web
app manifest / web app color scheme • Eyedropper API -
GDG Ahmedabad structuredClone Simplified way of cloning JavaScript Object Instead
of deep cloning, use structuredClone Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Samsung browser -
GDG Ahmedabad // old way const clone = JSON.parse(JSON.stringify(obj)); //new
way const clone = structuredClone(obj); -
GDG Ahmedabad createImageBitmap Easy way to load the image Avoid
memory leak and all with this new API Now supported in all major browsers, Chromium, Edge, Safari, Firefox, Samsung browser -
GDG Ahmedabad // old way const blobToImage = (blob) =>
{ return new Promise(resolve => { const url = URL.createObjectURL(blob) let img = new Image() img.onload = () => { URL.revokeObjectURL(url) resolve(img) } img.src = url }) } -
GDG Ahmedabad // new way const blobToImage = (blob) =>
createImageBitmap(blob) -
GDG Ahmedabad There is more… • Top level await •
Private properties and methods in classes • Array at method • SharedArrayBuffer • URLPattern • Web Codecs API • Cascade layers