DEV Community

Rahman Mahmutović
Rahman Mahmutović

Posted on

"How I contributed to Firefox DevTools"

I Fixed a Firefox DevTools Bug (Bug 1717176)

When an element had box-sizing: border-box, the width and height
fields in Firefox DevTools Box Model panel were not editable at all.

The Fix

Two things needed to change:

  1. Unlock editingBoxModelMain.js was explicitly blocking
    border-box elements from being editable.

  2. Correct the valueborder-box width includes padding and
    borders, so I had to subtract them when opening the editor, and add
    them back when writing the new value.

if (isBorderBox && property === "width") {
  initialValue -= this.getNonContentWidth(); // show content size
  // on change: value += getNonContentWidth() // write correct CSS
}
Enter fullscreen mode Exit fullscreen mode

Result

You can now click and edit width/height on any border-box element
directly in the Box Model panel.

Commit: 905f035

Top comments (0)