Skip to content

Remove incorrect usage of "declarative" in Popover_API index.md #40342

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

Merged
merged 1 commit into from
Jul 13, 2025

Conversation

mfp22
Copy link
Contributor

@mfp22 mfp22 commented Jul 13, 2025

Description

Describing the HTML attribute usage as "declarative" is redundant at best, and incorrect if using a definition of "declarative" that isn't just "whatever makes it into HTML."

In the case of popover attributes, the button is commanding the popover to appear. That's imperative by the English definition of "imperative": "Expressive of a command." https://www.merriam-webster.com/dictionary/imperative

The dialog open attribute is an example of what a declarative version of this would look like, with the dialog declaring its own behavior instead.

Motivation

Clarity

@mfp22 mfp22 requested a review from a team as a code owner July 13, 2025 22:29
@mfp22 mfp22 requested review from wbamberg and removed request for a team July 13, 2025 22:29
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Jul 13, 2025
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and welcome to MDN.

The text is not wrong. Using HTML attributes to define behaviour is declarative programming - it describes the intent without spelling out the control flow. The use of declarative and imperative to differentiate between HTML-alike and using programming languages normal in software programming.

That said, completely agree it is redundant. I much prefer your wording.

I'm going to merge this, but note that others might not for similar changes in future. Because there are so few reviewers, we try to focus on making sure that we concentrate on things that are wrong or ambiguous - that's why you'll see grammar changes being rejected unless they make a concrete difference.

Copy link
Contributor

Preview URLs

@hamishwillee hamishwillee merged commit 5427267 into mdn:main Jul 13, 2025
7 checks passed
@mfp22
Copy link
Contributor Author

mfp22 commented Jul 13, 2025

Thank you for the feedback. I wasn't entirely sure what the response would be.

Originally, imperative and declarative were used to describe paradigms for isolated, static programs. Once programs became more interactive and time entered the equation, people continued to think of imperative and declarative as only describing how static things were described instead of adjusting based on the meaning of the word itself. FRP in 1997 introduced the idea that behavior over time could be declarative, but the industry is still in the process of absorbing that mindset. But it's happening naturally everywhere reactivity is introduced, including JSX and signals. You'll see people describing those as declarative, in opposition to imperative patterns.

If you consider the behavior of the popover over time, that is what the command is contributing to. The button is part of the control flow of the popover's behavior over time.

I know people will disagree, but I prefer this definition for many reasons, but most of all because it follows the literal English definition of "imperative" instead of industry jargon with a lot of baggage and contradictions.

Thank you again for being nice while disagreeing. Not everybody is :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants