Page MenuHomePhabricator

Streamline IconElement/IndicatorElement visibility (set 'display: none' on them in a generic way when they are not used)
Closed, ResolvedPublic

Description

Currently, as of v0.20.0, we're outputting IconElement-icon/IndicatorElement-indicator in every widget using those mixins, no matter if they are used or not.

Although I'd prefer not to see them in the rendered DOM tree at all, minimizing the overhead by not outputting them on case by case might be not useful from a JS architecture and developer time investment perspective.
What I would want us to consider though is a generalization of the behaviour, removing treatment in places like ButtonElement and use something like:

.oo-ui-widget {
	.oo-ui-iconElement-icon,
	.oo-ui-indicatorElement-indicator {
		display: none;
	}

	&.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator,
	&.oo-ui-labelElement .oo-ui-labelElement-label {
		// Vertical align text
		display: inline-block;
		vertical-align: middle;
	}

	.theme-oo-ui-widget();
}

It would remove the non-used elements from the render tree, so being a simplification and additionally a minor performance improvement.
Thoughts?

T161177 icon&indicator positioning Dropdown _after - OOjs UI Demos 2017-04-05.png (486×1 px, 56 KB)

T160593 OOjs UI Demos 2017-04-07.png (422×1 px, 31 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Volker_E moved this task from Backlog to Doing on the OOUI board.

Not much? Maybe it saves a display: block or two somewhere. I don't mind either way if you want to change it.

Volker_E triaged this task as Low priority.

Change 383493 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[oojs/ui@master] WikimediaUI theme: Streamlining icon/indicator visibility

https://gerrit.wikimedia.org/r/383493

Change 383493 merged by jenkins-bot:
[oojs/ui@master] WikimediaUI theme: Streamlining icon/indicator visibility

https://gerrit.wikimedia.org/r/383493

Volker_E moved this task from Doing to OOjs-UI-0.23.4 on the OOUI board.
Volker_E edited projects, added OOUI (OOjs-UI-0.23.4); removed OOUI.
Volker_E removed a project: Patch-For-Review.
Volker_E removed a subscriber: gerritbot.
matmarex renamed this task from Streamline IconElement/IndicatorElement handling to Streamline IconElement/IndicatorElement visibility (set 'display: none' on them in a generic way when they are not used).Oct 18 2017, 6:17 PM

Change 385236 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[oojs/ui@master] Revert icon/indicator positioning to OOjs UI v0.23.3

https://gerrit.wikimedia.org/r/385236

Change 385236 abandoned by Bartosz Dziewoński:
Revert icon/indicator positioning to OOjs UI v0.23.3

https://gerrit.wikimedia.org/r/385236

Volker_E raised the priority of this task from Low to Needs Triage.Apr 3 2018, 8:43 PM
Volker_E moved this task from Backlog to Done on the UI-Standardization-Kanban board.
Volker_E removed a project: Patch-For-Review.

Change 385236 restored by Bartosz Dziewoński:
Revert icon/indicator positioning to OOjs UI v0.23.3

https://gerrit.wikimedia.org/r/385236

Change 385236 abandoned by Bartosz Dziewoński:
Revert icon/indicator positioning to OOjs UI v0.23.3

Reason:
Taking a different approach, see T178437#4277330.

https://gerrit.wikimedia.org/r/385236