Page MenuHomePhabricator

mw.notify() should have "autoHideSeconds" option settable.
Closed, ResolvedPublic

Description

For now, mw.notify() function does not take "autoHideSeconds" parameter, but notification implements this value. We should add this as option in defaults.

Event Timeline

Filip updated the task description. (Show Details)
Filip renamed this task from mw.notify() should have "autoHideSecounds" option settable. to mw.notify() should have "autoHideSeconds" option settable..Jan 13 2017, 4:45 PM
Filip updated the task description. (Show Details)

Change 331989 had a related patch set uploaded (by Filip):
Added "autoHideSeconds" setting in mw.notify()

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

Change 331989 merged by jenkins-bot:
Added "autoHideSeconds" setting in mw.notify()

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

Change 333161 had a related patch set uploaded (by Krinkle):
mw.notification: Re-implement autoHideSeconds as string preset option

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

Krinkle added subscribers: MtDu, Krinkle.

The change now looks ok, but I don't think we should show it forever. See https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.notification. There is an option called autoHideSeconds, which defaults to 5. That is what is causing the problem. I think we should change it to 10.

I would recommend against individual uses of mw.notify arbitrarily overriding the duration for notification bubbles. While I recognise the need for an option besides only "stay indefinitely until clicked" and "hide after 5 seconds", I'd rather this be a built-in option to avoid user confusion and set better expectations. I do not expect development of individual features that happen to include notifications to spend adequate time evaluating how long is "appropiate" and consistent with other interfaces. As such, we should provide better defaults so that developers don't have to eyeball this (since we'd make indeterministic guesses).

Previously autoHideSeconds was configurable through defaults, but not overridable per notification. This is by design and I'd like to restore that. Perhaps we can strike a compromise by allowing one of N presets to be used as timeout? E.g. 'short' for 5 seconds (default), and 'long' as 10 seconds (or 30?).

Change 333161 merged by jenkins-bot:
mw.notification: Re-implement autoHideSeconds as string preset option

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

Change #1038896 had a related patch set uploaded (by Sportzpikachu; author: Sportzpikachu):

[mediawiki/core@master] mw.notification: Document autoHideSeconds property

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

Change #1038896 merged by jenkins-bot:

[mediawiki/core@master] mw.notification: Document autoHideSeconds property

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