Page MenuHomePhabricator

FloatingButton: Add FloatingButton component to Codex
Open, MediumPublic

Assigned To
None
Authored By
Volker_E
Mar 22 2021, 3:26 PM
Referenced Files
F36824456: image.png
Feb 13 2023, 10:40 PM
F36824454: image.png
Feb 13 2023, 10:40 PM
F36824452: image.png
Feb 13 2023, 10:40 PM
F36824446: image.png
Feb 13 2023, 10:36 PM
F36824444: image.png
Feb 13 2023, 10:36 PM
F36816090: image.png
Feb 8 2023, 7:51 PM
F36815909: image.png
Feb 8 2023, 7:51 PM
F36816107: image.png
Feb 8 2023, 7:51 PM

Description

Background

Note this captures the floating button only, not floating tools and dialogs (see T280330).

Description

A prominent button that floats on top of the UI

User stories

Add at least one user story.

History

Multiple products have introduced a floating button in their UI, making this a candidate for evaluation to add to the DSG/as a Codex component via the DST governance model. Coming out of the work on the help panel (see T206717) was a need for a floating action button that:

  • Is anchored to a fixed position
  • Appears in front of *all content* on the screen.
  • Appears more prominently and clearly seen as "above" all other content
Outdated Example:Current example as of Nov 2022Example in different states
image.png (154×494 px, 24 KB)
image.png (196×194 px, 11 KB)
image.png (294×1 px, 69 KB)

Known use cases

Growth - Help panel button
image.png (342×658 px, 55 KB)
image.png (528×772 px, 84 KB)
Growth - Structured task button next to help
image.png (366×628 px, 43 KB)
Web - Vector 2022 toggle width button
image.png (86×142 px, 4 KB)
image.png (1×1 px, 273 KB)
image.png (1×1 px, 334 KB)
WMDE - Help button within a Process dialog
image.png (388×720 px, 152 KB)
image.png (1×2 px, 888 KB)
Keyboard input toggle menu on each field
image.png (768×1 px, 619 KB)
CX proposal to switch from a toggle on each field to a single floating button (not in production)

Existing implementations

Wikimedia community:

  • GrowthExperiments Newcomer help panel open/close button and structured task button
  • Vector 2022 content width toggler

External libraries:

Wikimedia Design Style Guide links:

  • n/a, not included in the DSG

Codex implementation

Component task owners

  • Designer: add the main designer's name
  • Developer: add the main developer's name

Open questions

  • Are there any limits on which icons can be used? Should there be default icons for expand/collapse, for example?
  • Can we use the FloatingUI library, which is currently used in Codex for sizing and placement of dropdown menus?

Design spec

Once a component spec sheet has been created in Figma, remove the note stating that the spec is missing and link to the spec below.

A component spec sheet has not been created yet.

Component spec sheet
Anatomy

Designer should list the structure and properties of the component.

Style

Designer should list the visual features of the component.

Interaction

Designer should list interaction specifications.

Documentation

Designer should describe how the component should be documented, including configurable and standalone demos.


Acceptance criteria

Minimum viable product (MVP)

This task covers the minimum viable product (MVP) version of this component. MVP includes basic layout, default states, and most important functionality.

MVP scope

  • MVP only covers the FloatingButton itself. In the future, the FloatingButton component may be used inside a new FloatingTools component, which displays a floating panel when a FloatingButton is pressed
  • Structure and style of the FloatingButton. This includes a way to include a single icon, or an icon for each state (on/off)
  • Styles for all potential states of the FloatingButton. States should make sense for FloatingButtons that show/hide a floating tool, or that simply indicate one state vs. another (e.g. the width toggle)
  • Proper z-index token set on the FloatingButton to ensure it will float above even Dialogs
  • State can be toggled by the user or set in the parent component (possibly use v-model)
  • A single position (bottom right)

Design

  • Design the Figma spec sheet and add a link to it in this task
  • Update the component in the Figma library. This step will be done by a DST member.

Code

  • Implement the component in Codex

Future work

  • (Potential) Other positioning options
  • Guidelines on how to use FloatingButtons. These are critical for 2 use cases:
    • An app that adds 2 or more FloatingButtons that should display side by side. Guidelines may cover placement and recommended max number of buttons.
    • Multiple apps adding FloatingButtons that could potentially overlap (e.g. the GrowthExperiments help panel and the width toggle). Guidelines may cover when it's acceptable to use a FloatingButton, how to deal with potential overlap, and alternate recommendations if a FloatingButton is not the right choice

Event Timeline

Volker_E renamed this task from Capture floating button in DSG to Capture floating button type in DSG.Mar 22 2021, 3:26 PM

Thanks for creating this task @Volker_E! I wonder if we could resurrect or incorporate the task description from this task T210770:

Use case

Coming out of the work on the help panel (see T206717) was a need for a floating action button that is:

  1. anchored to a fixed position
  2. appears in front of *all content* on the screen.
Proposal:

Since the button should appear more prominently and clearly seen as 'above' all other content, it is proposed we could add a config option to make the primary button have rounded corners and a more prominent drop shadow.
Example:

image.png (154×494 px, 24 KB)

(prototype here: http://reetssydney.github.io/prototypes/help-pane-v1/index.html)

This task is meant for a general discussion and collection of this pattern need and to decide if it

  • should be implemented only context-specific or
  • be part of the library and (in follow-up tasks) how to best implement it

Haha, sure. I don't forget it seems.

Volker_E updated the task description. (Show Details)
ldelench_wmf subscribed.

Discussed: Anne & Rita will do a timeboxed scoping session on this. We are approaching it as a separate component from T280330

AnneT renamed this task from Capture floating button type in DSG to Design and build initial FloatingButton component (MVP).Feb 9 2023, 10:13 PM
AnneT added a project: Codex.
AnneT updated the task description. (Show Details)

@RHo I updated the task description to add a little bit more info, and a bunch of open questions. I think the first open question, about the scope of the Codex component, will be the most challenging to answer.

My initial thoughts: I think we should handle Z-index in the Codex component itself. It's not a FloatingButton unless it's floating, and we plan to set a standard Z-index scale in the Codex design tokens, so we should be able to set a value that will work in and out of MediaWiki.

In terms of placement, I think we may need to know more about potential use cases. Would this button always appear on the bottom right? I'm betting not, so we might want to make this configurable (e.g. a prop for placement with values like top-left, top-center, top-right, bottom-left.....etc.)

The thing I don't think we can handle inside Codex is the issue of conflicting FloatingButtons, as in the case of the GrowthExperiments button and the Vector width toggle. I think that sort of thing would need to be handled within MediaWiki. The real solution would be a system of registering FloatingButtons that can deal with multiple buttons, although I think the quick and dirty solution inside Vector (which hides the width toggle if the GrowthExperiments button is present) might be the best we can do with the resources we have.

I'd love to know your initial thoughts - please let me know what you think, or we can schedule a synchronous discussion sometime!

@RHo and I discussed the following open questions, decisions noted below:

Are any of the following are in scope for the Codex component itself? Or are they MediaWiki-specific?

  • Z-index (i.e. should the component take care of placing itself on top of all other content? What happens >when there are multiple floating buttons?)
  • X and Y placement (i.e. should we pre-define a location on top of the UI here? What happens when there are >multiple floating buttons?)
  • Z-index should be covered here via Codex z-index tokens.
  • We will offer at least one position option (starting with just bottom end, and potentially adding more options later).
  • We could add styles to space multiple FloatingButtons added by the same app (like we do for multiple checkboxes or messages)
  • We will not cover handling multiple FloatingButtons added by different apps/features in MediaWiki. This is outside the scope of the Codex component itself. We can, however, include guidelines for how to account for this (and inform people of this potential pitfall)

What states should the FloatingButton have?

See the states in the task description. It seems like these should work for FloatingButtons that show/hide a tool, and FloatingButtons that simply toggle between two states (like the width toggle)

Some FloatingButtons will trigger another element to appear, change state while that element is visible, then return to the default state when the element is dismissed. How will the FloatingButton and a potential parent/sibling component communicate? We are not building other floating tools as part of this task, but we should consider how to prepare FloatingButton in a way that will work with future components.

We can probably use a ToggleButton with v-model to handle this.

AnneT triaged this task as Medium priority.Feb 13 2023, 11:24 PM
AnneT updated the task description. (Show Details)
AnneT moved this task from Needs Refinement to Backlog on the Design-System-Team board.

@ldelench_wmf I've added this to the backlog with "medium" priority. We'll have to decide when we want to prioritize this, and who will do the design/implementation work

The IME keyboard toggle is a special case, I'm not convinced it falls into the floating toggle button category. It's always bound to an input element and sticks to it's bottom end position. The task description is already limiting the MVP to viewport bottom end, not a relative position.
I'd even conclude, that the IME keyboard toggle is an outdated and somewhat problematic UX pattern and should be reconsidered to be changed to an intra input action similar to the clear button. See also T301540.
In any case, it doesn't belong into the MVP scope.

The IME keyboard toggle is a special case, I'm not convinced it falls into the floating toggle button category. It's always bound to an input element and sticks to it's bottom end position. The task description is already limiting the MVP to viewport bottom end, not a relative position.
I'd even conclude, that the IME keyboard toggle is an outdated and somewhat problematic UX pattern and should be reconsidered to be changed to an intra input action similar to the clear button. See also T301540.
In any case, it doesn't belong into the MVP scope.

Apologies if unclear, but that was added intending to show a proposed use-case by @Pginer-WMF to provide a single floating action button instead (the mock pasted in the adjacent cell) in future for the input on the entire UI.

AnneT renamed this task from Design and build initial FloatingButton component (MVP) to FloatingButton: Add FloatingButton component to Codex.Feb 21 2023, 7:50 PM
AnneT updated the task description. (Show Details)