Qu’est-ce que HTML ? étiquette?

Lenovo
TEMPORAIREMENT NON DISPONIBLE
RETIRÉ DU MARCHÉ
Non disponible pour le moment
À venir!
Les unités supplémentaires seront facturées au prix sans le bon de réduction en ligne. Acheter les unités supplémentaires
Nous sommes désolés, la quantité maximale que vous pouvez acheter à ce prix incroyable avec le bon de réduction en ligne est de
Ouvrez une session ou créez un compte afin de sauvegarder votre panier!
Ouvrez une session ou créez un compte pour vous inscrire aux récompenses
Voir le panier
Supprimer
Votre panier est vide! Ne ratez pas les derniers produits et économies - trouvez votre prochain portable, PC ou accessoire préférés.
article(s) dans le panier
Certains articles de votre panier ne sont plus disponibles. Veuillez vous rendre à l'adresse panier pour plus de détails.
a été retiré
Veuillez revoir votre panier car des articles ont changé.
sur
Contient des accessoires
Sous-total
Passez à la caisse
Oui
Non
Recherches populaires
Que cherchez-vous aujourd’hui?
Tendance
Recherches récentes
Articles
Tous
Annuler
Meilleures recommandations
Voir tout >
À partir de
Glossaire    
En savoir plus    
ÉtoileÉtoile

Vente annuelle

vente de portables Lenovovente de portables Lenovo

Aubaines sur les portables

Aubaines sur les PC – BureauAubaines sur les PC – Bureau

Aubaines sur les PC – Bureau

Aubaines sur les postes de travailAubaines sur les postes de travail

Aubaines sur les postes de travail

ContrôleurContrôleur

Aubaines sur les ordinateurs et les accessoires de jeux

SourisSouris

Aubaines sur les accessoires et les appareils électroniques pour ordinateurs

MoniteurMoniteur

Aubaines sur les moniteurs

Tablette et téléphoneTablette et téléphone

Aubaines sur les tablettes

ServeurServeur

Aubaines sur les serveurs et le stockage

Étiquette de rabaisÉtiquette de rabais

Liquidation


What is HTML <dialog> tag?

The HTML <dialog> tag defines a native modal or non-modal dialog box in a web page. It supports built-in dialog behaviors-like focus management, modality control, and accessibility, without requiring extra scripts or ARIA roles. This semantic element streamlines alert windows, confirmation prompts, and interactive forms in modern web applications, while ensuring clean and maintainable markup.

What is the purpose of the open attribute in HTML <dialog> tag?

The open attribute signals that the <dialog> tag is currently visible and interactive. Without it, the dialog remains hidden. Although you can manually toggle the attribute, developers are encouraged to use the dialog's internal methods for consistent behavior. The attribute helps manage dialog state declaratively, indicating visibility in markup while facilitating dynamic control via JavaScript dialogue APIs.

What methods control dialog visibility in HTML <dialog> tag?

The HTML <dialog> element offers two native methods for controlling its visibility: one opens the dialog without blocking page interaction, and one opens it as a modal that prevents interaction elsewhere. A separate method closes the dialog. These built-in functions simplify overlay control without the need for manual class toggling or complex DOM manipulation, ensuring consistent handling across browsers.

What is the difference between modal and non-modal in HTML <dialog> tag?

The HTML <dialog> tag supports modal and non-modal modes. Modal dialogs block interaction with the rest of the page and display a backdrop overlay. Non-modal dialogs allow users to interact with both the dialog and other page elements simultaneously. This flexibility supports various user experiences-use modal dialogs for critical actions and non-modal dialogs for contextual information.

How does HTML <dialog> tag manage keyboard focus?

The HTML <dialog> tag automatically manages keyboard focus when opened modally. It traps focus within the dialog content, ensuring screen readers and keyboard users remain inside that context. Upon closing, focus returns to the element that triggered the dialog. Focus is initially placed on the first focusable element or one marked with autofocus, promoting strong accessibility out of the box.

What role does the ::backdrop pseudo-element play in HTML <dialog> tag?

The ::backdrop pseudo-element styles the overlay behind a modal <dialog> tag, providing visual separation between the dialog and page content. It enables customizable effects like dimming, blurring, or color overlays. This improves clarity and focus when critical interactions are required, without necessitating additional wrappers or CSS for backdrop effects.

What is the returnValue property in HTML <dialog> tag?

The returnValue property stores a string that indicates why a <dialog> was closed, such as which button was clicked. This value can be retrieved in a close event listener, enabling developers to act on user decisions. When the dialog closes via a form submission with dialog method, the property automatically reflects the button's value, providing clean return-state handling.

What events does HTML <dialog> tag support?

The HTML <dialog> element supports events like cancel, close, beforetoggle, and toggle. cancel fires when the user requests dismissal (e.g., pressing Esc), close when the dialog closes, and the toggle events when open-state changes. Handling these events enables developers to customize behaviors, such as preventing close or tracking state, without writing extra event logic.

What is the cancel event in HTML <dialog> tag?

The cancel event fires when the user dismisses a modal <dialog> tag through default actions like pressing Esc. It is cancelable, allowing developers to intercept and prevent dialog closure if needed. This event precedes the close event, enabling nuanced control over dialog dismissal behavior and user interactions.

Is HTML <dialog> tag supported across modern browsers?

Yes, the HTML <dialog> tag enjoys strong support in modern browsers; Chrome, Edge, Safari, Firefox, and Opera all support it. While legacy browsers such as Internet Explorer do not, polyfills are available to fill compatibility gaps, making it a reliable and semantic choice for production use.

Does HTML <dialog> tag trap background content as inert?

Yes, when displayed modally, the HTML <dialog> tag renders as a top-layer overlay and automatically sets background content to "inert." This blocks mouse and focus interaction outside the dialog, reinforcing modal semantics and improving accessibility compliance without additional coding.

Can developers use HTML <dialog> tag instead of custom modals?

Yes, using the native HTML <dialog> tag is recommended over custom modal solutions. It delivers built-in accessibility, focus control, semantics, and user interactions by default. This reduces code complexity, improves maintainability, and ensures consistent behaviors across browsers. For unsupported environments, a lightweight polyfill preserves functionality, making the built-in option a robust choice for dialog interfaces.

Does Esc key close HTML <dialog> tag by default?

Yes, for modal dialogs invoked with .showModal(), pressing the Esc key closes the <dialog> tag, triggering both cancel and close events. Non-modal dialogs opened with .show() do not close on Esc by default. Developers can intercept or disable Esc behavior using event listeners as needed.

Can focus return to trigger after closing HTML <dialog> tag?

Yes, when a modal <dialog> tag is closed, focus automatically returns to the element that originally opened it-typically a button or link. This built-in behavior supports seamless keyboard navigation and restores context for assistive technology users, promoting a smooth and accessible interaction flow.

Can nested dialogs work with HTML <dialog> tag?

Yes, the HTML <dialog> tag supports nested or stacked dialogs. Only the topmost modal blocks interaction, while pressing Esc or invoking close affects only that dialog. Proper event handling ensures each nested layer can be managed independently, enabling multi-step flows such as nested confirmations or wizards.

Should autofocus be used with HTML <dialog> tag?

Yes, developers should use the autofocus attribute on an element inside a <dialog> tag to set initial keyboard focus when opened. If no suitable focus target exists, setting autofocus on the dialog itself ensures usability. This practice enhances accessibility, ensuring users can immediately interact with critical dialog controls.

Is tabindex needed on HTML <dialog> tag?

No, tabindex is not necessary and should not be added to the <dialog> tag itself, as it isn't focusable directly. Instead, make interactive elements inside the dialog focusable using autofocus. The dialog element manages focus behavior internally, preventing unexpected focus order or conflicts.

Can HTML <dialog> tag improve accessibility?

Yes, the HTML <dialog> tag enhances accessibility through automatic focus management, background content inertness, aria-modal support, and Esc key handling. It inherently aligns with W3C and WCAG guidelines for modal interactions. Developers can further optimize by setting appropriate autofocus, labels, and close controls for full inclusive user experience.

Does HTML <dialog> tag support mobile interactions?

Yes, the HTML <dialog> tag supports mobile interactions robustly. It handles focus, overlays, and keyboard events (or Back button behavior) for responsive designs. The ::backdrop pseudo-element and modal behaviors adapt well to mobile browsers, providing native dialog interactions in touch environments without extra effort.

How does HTML <dialog> tag coexist with ARIA dialogs?

The HTML <dialog> tag implements ARIA dialog semantics natively by setting role="dialog" and aria-modal="true" when opened modally. This ensures ready interoperability with assistive technologies. Unlike custom ARIA implementations, <dialog> simplifies accessibility while reducing the need for boilerplate code and ARIA attributes.

Vous recherchez une excellente aubaine?
Magasinez Lenovo.com pour profiter d’aubaines sur les ordinateurs pour l’éducation, les accessoires, les offres groupées et plus encore.
Magasiner les aubaines

  • Boutique
    • Aubaines pour étudiants
    • Portables pour étudiant de la maternelle à la 12e année
    • Accessoires pour étudiants
    • Portables par major
    Ressource éducative
    Découvrir
    • Qu’est-ce que l’éducation STEM?
    • Meilleurs portables pour l'université
    • Rabais pour les étudiants et les enseignants
    • Programmes de durabilité Lenovo
    Étui de transport pour l’éducation

    Bien que tout soit fait pour garantir l’exactitude, ce glossaire est fourni purement à titre de référence et peut contenir des erreurs ou des inexactitudes. Il sert de ressource de base pour comprendre les termes et les concepts fréquemment utilisés. Pour des obtenir des informations détaillées ou une assistance relative à nos produits, nous vous invitons à visiter notre site de soutien, où notre équipe se fera un plaisir de répondre à toutes vos questions.

    Entrez une adresse électronique pour recevoir des courriels promotionnels et des promotions de Lenovo. Consultez notre Déclaration de confidentialité pour plus de détails.
    Veuillez entrer la bonne adresse courriel!
    Adresse courriel requise
    • Facebook
    • Twitter
    • YouTube
    • Pinterest
    • TikTok
    • instagram
    Choisir le pays ou la région :
    Pays
    AndroidIOS

    non défini

    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini

    non défini

    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini

    non défini

    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini

    non défini

    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini

    non défini

    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    • non défini
    ConfidentialitéCarte du siteModalitésPolitique des soumissions externesModalités de venteDéclaration contre l'esclavagisme et la traite des personnes
    Comparer ()
    x
    Appeler
    
                        
                    
    Sélectionnez votre magasin