Page MenuHomePhabricator

Update WikiEditor's add button functionality to make sure added buttons behave like OOUI buttons
Open, Needs TriagePublic

Description

When one customizes the WikiEditor toolbar, adding a button according to the docs, the added buttons behave differently than the native buttons.

They have different DOM structures:

image.png (266×601 px, 25 KB)

And in some cases (e.g. changed default browser font size) it results in them having different sizes and misaligned highlighting:

image.png (46×250 px, 2 KB)

The reason for the last is that the custom buttons use fixed sizes (32px) while the native OOUI buttons use sizes relative to the current font size (2.14285714em).

I currently fix this in Convenient-Discussions with this rule:

.cd-commentForm .tool-button {
  width: 2.14285714em;
  height: 2.14285714em;
  border: 1px solid transparent;
}