Open Bug 2000150 Opened 4 months ago Updated 1 month ago

"Add class" button (.cls) should be disabled when a class can't be added to the selected node

Categories

(DevTools :: Inspector, enhancement, P3)

enhancement

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: nchevobbe, Assigned: ssii.emploi, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=js])

The button should be disabled for:

  • doctype
  • text node
  • comment node
  • document / root node
  • pseudo element
Mentor: nchevobbe
Keywords: good-first-bug

this is the button we should disable https://searchfox.org/firefox-main/rev/c82adde571c24d89da3ef13f11245c8f572ba1e6/devtools/client/inspector/rules/rules.js#196

this.classToggle = doc.getElementById("class-panel-toggle");

we could do something similar to what we do for the "Add Rule" button https://searchfox.org/firefox-main/rev/c82adde571c24d89da3ef13f11245c8f572ba1e6/devtools/client/inspector/rules/rules.js#767-776

/**
 * Disables add rule button when needed
 */
refreshAddRuleButtonState() {
  const shouldBeDisabled =
    !this._viewedElement ||
    !this.inspector.selection.isElementNode() ||
    this.inspector.selection.isAnonymousNode();
  this.addRuleButton.disabled = shouldBeDisabled;
},

Some tests should be added to https://searchfox.org/firefox-main/rev/c82adde571c24d89da3ef13f11245c8f572ba1e6/devtools/client/inspector/rules/test/browser_rules_class_panel_toggle.js

Priority: -- → P3
Whiteboard: [lang=js]

Hi, I would like to work this on this bug

Flags: needinfo?(nchevobbe)

(In reply to Areeba from comment #2)

Hi, I would like to work this on this bug

Hello Areeba, and thanks for offering help!
The bug is now assigned to you

You can follow https://firefox-source-docs.mozilla.org/setup/index.html#getting-set-up-to-work-on-the-firefox-codebase to setup the work environment.
Let me know if you have any questions!

Assignee: nobody → areeba.mobeen
Status: NEW → ASSIGNED
Flags: needinfo?(nchevobbe)

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.

Assignee: areeba.mobeen → nobody
Status: ASSIGNED → NEW

Hello, I would like to work on this Nicolas!
Mehdi

(In reply to mehdiakiki from comment #5)

Hello, I would like to work on this Nicolas!
Mehdi

Hello mehdiakiki, the bug is now yours :)
Let me know if you have any question

Assignee: nobody → ssii.emploi
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.