Rework task pane UI and document design guidelines

- Add a header, a shared accordion, a docked status region, and token-based styles
- Use the blue primary style for every action button and collapse all sections by default
- Improve labels, selection hints, destructive confirmations, grid semantics, and narrow-pane layout
- Add docs/UI_GUIDELINES.md and update the README, user guide, and developer guide
This commit is contained in:
schihei committed 2026-11-25 12:40:12 +01:00
1 parent 89989c04e9
commit e223dc61c8
23 files changed
+719 -549

No files matched your search

+28 -6
View File
@@ -194,6 +194,7 @@ For raw Fluent buttons that need a confirmation dialog:
onConfirm={remove}
confirmTitle="Remove the grid?"
confirmMessage="This removes the grid from the current slide."
confirmLabel="Remove"
>
Remove
</ConfirmButton>
@@ -201,12 +202,15 @@ For raw Fluent buttons that need a confirmation dialog:
### Section
Collapsible grouping with consistent styling:
A single disclosure item. `Section` renders an `AccordionItem`, so it must be
placed inside the shared `Accordion` in `App.tsx`:
```tsx
<Section title="My Feature">
<MyFeatureComponent />
</Section>
<Accordion multiple collapsible defaultOpenItems={["content"]}>
<Section title="My Feature">
<MyFeatureComponent />
</Section>
</Accordion>
```
## Creating a New Tool
@@ -350,6 +354,21 @@ Test pure functions and helpers directly. Office.js interactions should be kept
Continuous integration runs lint, typecheck, tests, build, and manifest validation on every push and pull request.
## UI Guidelines
The pane follows Fluent 2 and Microsoft's Office Add-in UX guidance. The full
rules and review checklist live in [`docs/UI_GUIDELINES.md`](UI_GUIDELINES.md).
Key points:
- Use Fluent tokens for colour, spacing, type, radius, and motion. No literal
hex values in UI styles (slide colours are the exception).
- Keep one scroll container. Sections must not set `maxHeight` or `overflow`.
- All action buttons use the blue primary style; destructive actions are
confirmed by a dialog.
- Labels are verb + object, with a short hint when a selection is required.
- Keep the single always-mounted `role="status"` region for feedback.
## Performance Guidelines
- **Batch `context.sync()` calls.** Load all needed properties, then sync once.
@@ -366,12 +385,15 @@ Continuous integration runs lint, typecheck, tests, build, and manifest validati
4. Add confirmations for destructive operations.
5. Make repeated add operations idempotent.
6. Use Fluent `Field`/`Input`/`Dropdown` controls so labels and keyboard navigation work.
7. Announce results through the status region (`role="status"`).
8. Update docs when behavior changes.
7. Use design tokens and follow `docs/UI_GUIDELINES.md` for any new UI.
8. Announce results through the status region (`role="status"`).
9. Update docs when behavior changes.
## Resources
- [Office Add-ins documentation](https://learn.microsoft.com/office/dev/add-ins/)
- [Office Add-in UX design guidelines](https://learn.microsoft.com/office/dev/add-ins/design/add-in-design)
- [Office.js API reference](https://learn.microsoft.com/javascript/api/overview/office)
- [Fluent UI React v9](https://react.fluentui.dev/)
- [Fluent 2 design system](https://fluent2.microsoft.design/)
- [Vitest](https://vitest.dev/)
+127
View File
@@ -0,0 +1,127 @@
# Edison UI Guidelines
The task pane follows **Fluent 2** (`@fluentui/react-components` v9) and Microsoft's
[Office Add-in UX guidelines](https://learn.microsoft.com/office/dev/add-ins/design/add-in-design),
including WCAG 2.1 AA expectations. This document records the rules the codebase
follows so new tools stay consistent.
## Structure
The pane has three fixed regions (`src/taskpane/components/App.tsx`):
1. **Header** — Edison icon, name, and a short descriptor. Gives the pane identity
when several add-ins are open.
2. **Scroll area** — one vertical scroll owner containing a single `Accordion`
with one `Section` per tool group.
3. **Status dock** — always-mounted `role="status"` live region at the bottom.
It shows progress with a Stop button while processing, then the result.
Rules:
- Never add a second scroll container. Do not put `overflow: auto` or a fixed
`maxHeight` inside a section; the pane scrolls as a whole.
- `Section` renders an `AccordionItem`, so it must be a child of an `Accordion`.
- All sections start collapsed. Use `multiple` on the `Accordion` so several
groups can stay open.
## Design tokens
Use Fluent tokens for every colour, spacing, radius, shadow, and font value.
| Concern | Use |
|---|---|
| Colours | `tokens.colorNeutral*`, `tokens.colorBrand*`, `tokens.colorPalette*` |
| Spacing | `tokens.spacingHorizontal*`, `tokens.spacingVertical*` |
| Type | `tokens.fontFamilyBase`, `tokens.fontSizeBase200/300/400`, `tokens.fontWeightSemibold` |
| Radius | `tokens.borderRadiusMedium` |
| Elevation | `tokens.shadow2`, `tokens.shadow4` |
| Motion | `tokens.durationNormal`, `tokens.curveEasyEase` |
- No literal hex colours in UI styles. The only exceptions are the colours that
are written **into the slide** (grid, guideline, marking, watermark).
- Do not hand-roll shadows or theme-dependent colours; that is what broke dark
mode before v1.2.0.
- Placeholder/loading chrome in `taskpane.html` uses CSS variables with a
`prefers-color-scheme: dark` override.
## Typography and spacing
- Body text: `fontSizeBase300` (14 px). Metadata and hints: `fontSizeBase200`.
- Section headings: `fontSizeBase400` + `fontWeightSemibold`, neutral foreground.
- Pane padding: `spacingHorizontalL` (16 px). Gaps between related controls:
`spacingVerticalS`/`spacingHorizontalS` (8 px); between tool groups:
`spacingVerticalM` (12 px) via `Section`'s stack.
- Prefer `gap` on flex containers over spacer `<div>` elements.
- Do not use `Text size={100}` (10 px); it is below the readable minimum.
## Action hierarchy
The pane uses one button style: **all action buttons are blue** (`appearance="primary"`),
including secondary actions, Remove, Cancel, and Stop. This keeps the controls
visually consistent across sections.
| Action | Appearance |
|---|---|
| Every action button (run, add, remove, cancel, stop) | `primary` |
| Colour swatches | keep the swatch colour (never brand blue) |
| Horizontal/vertical direction toggles | `outline`, stateful |
- Keep destructive actions visually confirmed by a dialog even though the
trigger is blue.
- Dialog copy states exactly what will be removed or replaced. Cancel keeps
initial focus.
- Colour swatches are the one exception: they must show the colour that will be
written to the slide.
## Labels and copy
- Buttons use **verb + object**: "Add progress bar", "Remove guides",
"Match properties" — not "Add" / "Remove" on their own.
- Section titles are nouns ("Grid & Guidelines"), matching the User Guide.
- Add a one-line hint (`useCommonStyles().hint`, `Text size={200}`) above a tool
when the selection requirement is not obvious ("Select exactly two shapes").
- Avoid duplicating a section title in every button tooltip.
## Forms and groups
- One control → `Field label`. `Input` and `Dropdown` are field-aware, so the
label is associated automatically.
- A set of related controls (colour swatches, direction toggle) → visible `Text`
label plus a `role="group"` container with `aria-labelledby`.
- `Field`/`Dropdown` fill the pane width (`width: 100%`); numeric inputs may be
capped (`maxWidth: 180px`).
- Colour swatches are at least 32×32 px, show a check icon for the selected
value (not colour alone — WCAG 1.4.1), and expose `aria-pressed`.
## Feedback and accessibility
- Keep exactly one `role="status"` region mounted for the lifetime of the pane.
It announces progress and results without moving focus.
- Success messages auto-clear after 5 seconds; warnings and errors stay until
the next action.
- Icon-only controls need an accessible name (`aria-label` or a Fluent `Tooltip`
with `relationship="label"`).
- Do not rely on `title` alone for the accessible name.
- Every interactive control must be reachable and operable by keyboard.
- Target size: at least 32×32 px for icon-only controls; primary buttons are
full width of their container.
- Status text must not be the only indication of an error; the icon and colour
are paired with a message.
## Responsive behaviour
- Design for the minimum task-pane width (320 px). The pane can be narrower when
docked; the two-column button grids collapse to one column below 360 px
(`@media (max-width: 360px)`).
- Prefer wrapping toolbars and full-width controls over horizontal scrolling.
- Test at 320 px and ~480 px, in light and dark mode, with a collapsed section.
## Review checklist
- [ ] Only tokens for colours, spacing, type, radius, and motion
- [ ] All action buttons use the blue primary style; destructive actions confirmed
- [ ] Labels are verb + object; hints explain selection requirements
- [ ] One scroll container; no nested `maxHeight`/`overflow`
- [ ] Single always-mounted live region
- [ ] Icon-only controls have accessible names
- [ ] Works at 320 px, light and dark, keyboard only
+13 -3
View File
@@ -14,15 +14,21 @@ This guide will help you use the Edison PowerPoint Add-in to create professional
### Interface Overview
The Edison task pane is organized into collapsible sections:
The Edison task pane has three areas:
- **Header** - The Edison logo and the add-in name, so you can tell which add-in pane is open.
- **Sections** - A scrollable list of collapsible tool groups. All sections start collapsed; click a section title to expand or collapse it.
- **Status bar** - Docked at the bottom of the pane. It shows progress and a **Stop** button during long operations, then the result.
The sections are:
- **Content** - Tools for manipulating content and shapes
- **Progress Bar** - Add/remove presentation progress indicators
- **Confidential Marking** - Add/remove confidential labels
- **Draft Watermark** - Add/remove draft watermarks
- **Alignment** - Tools for aligning shapes and objects
- **Layout** - Grids and guidelines for the current slide
- **Settings** - Slide size and other per-presentation preferences
- **Grid & Guidelines** - Grids and guidelines for the current slide
- **Settings** - Slide size and version information
## Content Tools
@@ -127,6 +133,10 @@ Adds or removes a "DRAFT" watermark on slide masters to mark in-progress present
These tools align selected objects to the slide edges or center.
The alignment controls are icon buttons in a single row: the first three align
horizontally (left, center, right), the last three align vertically (top,
middle, bottom). Hover an icon to see its name.
### Horizontal Alignment
- **Left** - Aligns all shapes to the left edge of the slide