Skip to content

Commit

Permalink
Chore/0.52.x (#17103)
Browse files Browse the repository at this point in the history
* fix(useEventListener): use a proper .event and clean up properly (#16991)

* fix(useEventListener): use a proper .event and clean up properly

* update impl to use refs

* revert refs, use settimeout reset

* add changelog entry

* Export tree context (#16891)

* export tree context

* update changelog

* fix(Dropdown): Add missing prop type (#16920)

* Add missing prop type

* Add changelog

* fix(Tree): change selectionIndicator from visibility:hidden to display:none (#16922)

…y:none

- [ ] Addresses an existing issue: Fixes #0000
- [ ] Include a change request file using `$ yarn change`

As described in title.
`visibility: hidden` cause problem because the selectionIndicator still takes width

(optional)

* fix(useEventListener): avoid double handlers calls in React 17 (#16514)

* fix(useEventListener): avoid double handlers calls in React 17

* add changelog entry

* fix(MergeVariablesOverrides): return variables if they are defined (#16560)

* fix(MergeVariablesOverrides): return variables if they are defined

* fix(MergeVariablesOverrides): add changelog

* Update packages/fluentui/react-bindings/src/utils/mergeVariablesOverrides.ts

Co-authored-by: ling1726 <lingfangao@hotmail.com>

* fix(MergeVariablesOverrides): check for plain objects

* fix(MergeVariablesOverrides): fix test

Co-authored-by: ling1726 <lingfangao@hotmail.com>

* fix(react-context-selector): fix React warnings about setState() (#16714)

* WIP on fixing contextSelector

* fix(ContextSelector): fix

* fix(ContextSelector): selectors

* fix(ContextSelector): selectors tests fix

* fix(ContextSelector): changelog

* fix(ContextSelector): fix rollup

* fix(ContextSelector): flatten context value

* fix(ContextSelector): add comments

* Update packages/fluentui/CHANGELOG.md

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* fix(ContextSelector): move scheduler to peerDependencies

* Update packages/fluentui/react-context-selector/src/types.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-context-selector/src/types.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-context-selector/src/types.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-context-selector/src/createContext.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-context-selector/src/useContextSelector.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-context-selector/package.json

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>
Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* feat(Button): disabledFocusable for v0 Button (#16419)

* button disabled focusable for v0

* fixes

* changelog

* disable  pointer events only for disabled, not for disabledFocusable

* fix

* cleanup examples

* small revert

Co-authored-by: Juraj Kapsiar <jukapsia@microsoft.com>

* adding Channel Share Icon for ODSP (#16619)

* adding Channel Share Icon

* feat(FormTextArea): Add new FormTextArea component (#16660)

* feat(FormTextArea): add new FormTextArea component

* feat(FormTextArea): add test

* feat(FormTextArea): change type

* feat(FormTextArea): add changelog

* feat(TextArea): fix changelog

* Update packages/fluentui/react-northstar/src/components/TextArea/TextArea.tsx

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* feat(TextArea): add error exampel

* Update packages/fluentui/docs/src/examples/components/Form/Usage/FormExampleErrorAndSuccessful.tsx

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* feat(checkbox): add indeterminate support (#16081)

* feat(checkbox): add indeterminate support

* feat(checkbox): add props comment

* feat(checkbox): add best practices

* feat(checkbox): add changelog

* feat(checkbox): rename indicator

* feat(Checkbox): add mixed value support

* feat(Checkbox): remove inderminate prop

* feat(Checkbox): remove inderminate from state

* feat(Checkbox): remove cast

* Update packages/fluentui/CHANGELOG.md

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* feat(Checkbox): remove indeterminate from behavior

* feat(Checkbox): remove unecessary check

* feat(Checkbox): rename best practices

* feat(Checkbox): remove indeterminate from styles

* feat(Checkbox): rename example

* feat(Checkbox): update contorl

* Update packages/fluentui/react-northstar/src/themes/teams/components/Checkbox/checkboxStyles.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/react-northstar/src/themes/teams/components/Checkbox/checkboxStyles.ts

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Update packages/fluentui/docs/src/examples/components/Checkbox/States/index.tsx

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* feat(Checkbox): update styles

* feat(Checkbox): screener

Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>

* Adding imageAltText icon (#16884)

* adding imageAltText icon

* fix(felaRenderer): exclude className for CKEditor to avoid collisions (#17025)

* fix(felaRenderer): exclude className for CKEditor to avoid collisions

* add changelog entry

* Update packages/fluentui/react-northstar-fela-renderer/src/createFelaRenderer.tsx

* Update packages/fluentui/react-northstar-fela-renderer/src/createFelaRenderer.tsx

* fix(useEventListener): use a proper .event and clean up properly (#16991)

* fix(useEventListener): use a proper .event and clean up properly

* update impl to use refs

* revert refs, use settimeout reset

* add changelog entry

* fix(popupBehavior): remove role='complementary' from inline popup (#17032)

* fix(popupBehavior): remove role='complementary' from inline popup

* changelog

* add popup test

* chore: Automated release pipeline for fluent N* (#16866)

* add pack-nightly task

* Add nightly package to docsite

* Add post publish validation script

* Add canary release script

* Fix dep url when pack nightly tarball

* yaml pipeline

* update redirect

* fix pipeline

* rename

* nightly build fix

* remove todo

* gzip true

* make dropdown display nightly version properly

* update comment

* update pipeline

* put 0.0.0-nightly into const

* Update scripts/tasks/fluentui-publish.ts

Co-authored-by: ling1726 <lingfan.gao@microsoft.com>

* Update azure-pipelines.release-fluentui.yml

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>

* update pipeline

* update pipeline

* update pipeline

* hide clip board for nightly release

* Update azure-pipelines.release-fluentui.yml

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>

* Update scripts/tasks/fluentui-publish.ts

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>

* Update scripts/tasks/fluentui-publish.ts

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>

* update packtarball

* test pipeline

* Update falsy check of nightlyRelease

* fix doc build

* fix

* remove cruft

* separate fluent ui tasks

* store nightly tarballs in Build.ArtifactStagingDirectory

* cleanup after tar; add --no-verify-access

* add no-verify-access comment

* update after trying out real release

* add pipeline name

* update pipeline description

* Update scripts/fluentui-publish/index.ts

Co-authored-by: ling1726 <lingfan.gao@microsoft.com>

* fix screener build

* test adding nightly date to nightly tarball versions

* Update scripts/fluentui-publish/index.ts

Co-authored-by: ling1726 <lingfan.gao@microsoft.com>

* use newest folder for docsite

* Revert "use newest folder for docsite"

This reverts commit 2b8af70.

* make codesandbox consistent for nightly release

Co-authored-by: ling1726 <lingfan.gao@microsoft.com>
Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>
Co-authored-by: Amber <yuanboxue@microsoft.com>
Co-authored-by: Roman Sudarikov <pompomon@users.noreply.github.com>
Co-authored-by: ling1726 <lingfangao@hotmail.com>
Co-authored-by: Oleksandr Fediashov <alexander.mcgarret@gmail.com>
Co-authored-by: Juraj Kapsiar <jurokapsiar@gmail.com>
Co-authored-by: Juraj Kapsiar <jukapsia@microsoft.com>
Co-authored-by: Andrew Martin <andmarti@microsoft.com>
Co-authored-by: ling1726 <lingfan.gao@microsoft.com>
  • Loading branch information
10 people authored Feb 22, 2021
1 parent 9000aac commit d645fc8
Show file tree
Hide file tree
Showing 68 changed files with 1,355 additions and 595 deletions.
243 changes: 181 additions & 62 deletions azure-pipelines.release-fluentui.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,193 @@
pr: none
trigger: none

# Customize build number to include major version
# Example: fluentui_20190626.1
name: 'fluentui_$(Date:yyyyMMdd)$(Rev:.r)'

schedules:
# minute 0, hour 12 in UTC (5am in UTC+7), any day of month, any month, days 1-5 of week (M-F)
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?tabs=yaml&view=azure-devops#supported-cron-syntax
- cron: '0 12 * * 1-5'
displayName: 'Daily release (M-F at 5am)' # will be 4am when DST ends unless trigger is updated
branches:
include:
- master

resources:
repositories:
- repository: self
type: git
ref: master

variables:
# below are variables that cannot be configured at queue time
- group: 'Github and NPM secrets'
- name: docsiteVersion
- name: docsiteVersion # used by docsite
value: 0.0.0-nightly
- name: deployBasePath # used by docsite
value: 0.0.0-nightly
- name: officialRelease # used by docsite
value: true
- name: nightlyReleaseDate # used by nightly built docsite to setup codesandbox correctly
value: empty
- name: deployBasePath
value: empty
- name: officialRelease
value: 1

# below are variables configurable at queue time, so they cannot appear in yml file
# - name: publishDocsiteOnly # set it to true to only run Job_build_publish_doc
# value: false
# - name: publishOfficial # set it to true to publish package to npm, and publish docsite for official releases
# value: false
# - name: version # version to publish to npm; only make sense when publishOfficial=true
# value: canary # value can only be canary/patch/minor

pool: 'Self Host Ubuntu'

steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'

- script: |
ver=`node -p "require('./packages/fluentui/react-northstar/package.json').version"`
echo "##vso[task.setvariable variable=deployBasePath]$ver"
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
echo "Docsite base path published to for version $ver"
displayName: Set base path and version variables for job
- script: |
git config user.name "Fluent UI Build"
git config user.email "fluentui-internal@service.microsoft.com"
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui.git
displayName: Authenticate git for pushes
- task: Bash@3
inputs:
filePath: yarn-ci.sh
displayName: yarn
- script: |
PRODUCTION=true yarn build
displayName: yarn build
- script: |
NODE_ENV=production yarn build:fluentui:docs
displayName: yarn build:fluentui:docs
- task: PublishBuildArtifacts@1
displayName: 'Publish docsite as pipeline artifact'
inputs:
PathtoPublish: 'packages/fluentui/docs/dist'
ArtifactName: 'docsite_v$(docsiteVersion)'

- task: AzureUpload@2
displayName: Upload docs site
inputs:
SourcePath: 'packages/fluentui/docs/dist'
azureSubscription: 'UI Fabric (private)'
storage: fluentsite
ContainerName: '$web'
BlobPrefix: '$(deployBasePath)'
# uncomment to deploy to prod
# storage: fluentsite
# BlobPrefix: ''
# No NPM release in CI for now
# - script: |
# yarn test
# displayName: yarn test
#
# - script: |
# yarn lint
# displayName: yarn lint
#
# - script: |
# yarn release:fluentui:$(bumpType)
# displayName: yarn release:fluentui:$(bumpType)
jobs:
- job: Job_build_publish
workspace:
clean: all
displayName: Build and Release Fluent Packages
# skip this job if publishDocsiteOnly is true
condition: and(succeeded(), eq(variables.publishDocsiteOnly, false))

steps:
- template: .devops/templates/tools.yml

- script: |
git config user.name "Fluent UI Build"
git config user.email "fluentui-internal@service.microsoft.com"
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui.git
displayName: Authenticate git for pushes
- task: CmdLine@2
displayName: Checkout branch for version pushes
condition: and(succeeded(), eq(variables.publishOfficial, true))
inputs:
script: |
BRANCH_NAME=`echo $(Build.SourceBranch) | sed "s/refs\/heads\///"`
git checkout $BRANCH_NAME
git pull
- task: Bash@3
inputs:
filePath: yarn-ci.sh
displayName: yarn

- task: CmdLine@2
displayName: yarn buildci
inputs:
script: yarn buildci

- task: CmdLine@2
displayName: '[Nightly] Pack fluentui packages to ArtifactStagingDirectory'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
script: |
today=`date +%Y-%m-%d`
echo date today $today
echo "##vso[task.setvariable variable=date]$today"
yarn release:fluentui:pack-nightly
- task: AzureUpload@2
displayName: '[Nightly] Upload tarballs'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
SourcePath: $(Build.ArtifactStagingDirectory)
azureSubscription: 'UI Fabric (private)'
storage: fluentsite
ContainerName: nightly-builds
BlobPrefix: $(date) # upload tarballs to folder named by today's date
Gzip: true

- task: CmdLine@2
displayName: '[NPM] Publish to NPM'
condition: and(succeeded(), eq(variables.publishOfficial, true))
timeoutInMinutes: 2
inputs:
script: |
yarn logout
NPM_TOKEN=$(npmToken)
touch packages/fluentui/.npmrc
echo "@fluentui:registry=http://registry.npmjs.org/" > packages/fluentui/.npmrc
echo "registry=http://registry.npmjs.org/" >> packages/fluentui/.npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> packages/fluentui/.npmrc
yarn release:fluentui:$(version) --yes
yarn release:fluentui:post-validation
- template: .devops/templates/cleanup.yml

- job: Job_build_publish_doc
workspace:
clean: all
displayName: Build and Publish Docsite
dependsOn: Job_build_publish
# run this job when the previous job is succeeded or when publishDocsiteOnly is true
condition: or(succeeded(), eq(variables.publishDocsiteOnly, true))

steps:
- template: .devops/templates/tools.yml

- task: Bash@3
displayName: Yarn
inputs:
filePath: yarn-ci.sh

- task: CmdLine@2
displayName: 'Set nightlyReleaseDate'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
script: |
today=`date +%Y-%m-%d`
echo date today $today
echo "##vso[task.setvariable variable=nightlyReleaseDate]$today"
- task: CmdLine@2
displayName: 'Set base path and version'
condition: and(succeeded(), eq(variables.publishOfficial, true), ne(variables.version, 'canary'))
inputs:
script: |
ver=`node -p "require('./packages/fluentui/react-northstar/package.json').version"`
echo "Docsite base path published for version $ver"
echo "##vso[task.setvariable variable=deployBasePath]$ver"
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
echo "##vso[task.setvariable variable=nightlyReleaseDate]"
- task: CmdLine@2
displayName: 'Set base path and version for canary'
condition: and(succeeded(), eq(variables.publishOfficial, true), eq(variables.version, 'canary'))
inputs:
script: |
ver=`node -p "require('./packages/fluentui/lerna.json').version"`
echo "Docsite base path published for version $ver"
echo "##vso[task.setvariable variable=deployBasePath]$ver"
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
echo "##vso[task.setvariable variable=nightlyReleaseDate]"
- task: CmdLine@2
displayName: Build
inputs:
script: |
echo deployBasePath $(deployBasePath) docsiteVersion $(docsiteVersion) nightlyReleaseDate $(nightlyReleaseDate)
NODE_ENV=production yarn build:fluentui:docs
- task: PublishPipelineArtifact@1
displayName: Publish Docsite as Pipeline Artifact
inputs:
path: packages/fluentui/docs/dist
artifactName: docsite_v$(docsiteVersion)

- task: AzureUpload@2
displayName: Upload to Azure
inputs:
SourcePath: packages/fluentui/docs/dist
azureSubscription: 'UI Fabric (private)'
storage: fluentsite
ContainerName: $web
BlobPrefix: $(deployBasePath)
Gzip: true

- template: .devops/templates/cleanup.yml
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
"postinstall": "node ./scripts/postinstall.js",
"prettier": "node scripts/prettier.js",
"rebuild": "node ./scripts/invalidate-just-cache.js && yarn build --reset-cache",
"release:fluentui:preminor": "yarn workspace @fluentui/scripts just fluentui:publish:preminor",
"release:fluentui:minor": "yarn workspace @fluentui/scripts just fluentui:publish:minor",
"release:fluentui:patch": "yarn workspace @fluentui/scripts just fluentui:publish:patch",
"release:fluentui:minor": "node -r ./scripts/ts-node-register ./scripts/fluentui-publish publish-minor",
"release:fluentui:patch": "node -r ./scripts/ts-node-register ./scripts/fluentui-publish publish-patch",
"release:fluentui:canary": "node -r ./scripts/ts-node-register ./scripts/fluentui-publish publish-canary",
"release:fluentui:post-validation": "node -r ./scripts/ts-node-register ./scripts/fluentui-publish post-publish",
"release:fluentui:pack-nightly": "node -r ./scripts/ts-node-register ./scripts/fluentui-publish pack-nightly",
"rename-package": "node -r ./scripts/ts-node-register ./scripts/rename-package.ts",
"runto:lerna": "node ./scripts/monorepo/runTo.js",
"run:published": "node ./scripts/monorepo/runPublished.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ export const buttonBehaviorDefinition: Rule[] = [
.forProps({ disabled: true, loading: true })
.doesNotHaveAttribute('disabled'),
BehaviorRule.root()
.forProps({ disabled: true })
.hasAttribute('aria-disabled', 'true'),
.forProps({ disabledFocusable: true })
.hasAttribute('aria-disabled', 'true')
.doesNotHaveAttribute('disabled'),
BehaviorRule.root()
.forProps({ disabledFocusable: true })
.doesNotHaveAttribute('disabled')
.hide(),
BehaviorRule.root()
.forProps({ loading: true })
.hasAttribute('aria-disabled', 'true'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export const popupBehaviorDefinitionPopupSlot: Rule[] = [
.forProps({ trapFocus: false })
.doesNotHaveAttribute('aria-modal')
.description(`if 'trapFocus' is 'false'.`),
BehaviorRule.slot('popup')
.forProps({ inline: true })
.doesNotHaveAttribute('role')
.description(`if 'inline' is 'true'.`),
];

export const popupBehaviorDefinition = popupBehaviorDefinitionTriggerSlotNotTabbable
Expand Down
23 changes: 23 additions & 0 deletions packages/fluentui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
# Changelog
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!--------------------------------[ v0.52.1 ]------------------------------- -->
## [v0.52.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-northstar_v0.52.0) (2021-02-22)
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-northstar_v0.51.7..@fluentui/react-northstar_v0.52.1)

### Features
- Added `disabledFocusable` prop for `Button` component. @jurokapsiar ([#16419](https://github.com/microsoft/fluentui/pull/16419))
- Added `ChannelShareIcon` @notandrew ([#16619](https://github.com/microsoft/fluentui/pull/16619))
- Added `FormTextArea` component @assuncaocharles ([#16660](https://github.com/microsoft/fluentui/pull/16660))
- Added `checked="mixed"` support for `Checkbox` @assuncaocharles ([#16081](https://github.com/microsoft/fluentui/pull/16081))
- Added `ImageAltTextIcon` @notandrew ([#16884](https://github.com/microsoft/fluentui/pull/16884))

### Fixes
- Fix a memory leak in `useEventListener` @layershifter @miroslavstastny ([#16991](https://github.com/microsoft/fluentui/pull/16991))
- Export treeContext from `Tree` @yuanboxue-amber ([#16891](https://github.com/microsoft/fluentui/pull/16891))
- Add missing prop type for `Dropdown` @pompomon ([#16920](https://github.com/microsoft/fluentui/pull/16920))
- Change `TreeTitle`'s `selectionIndicator` from visibility:hidden to display:none @yuanboxue-amber ([#16922](https://github.com/microsoft/fluentui/pull/16922))
- Fix event handlers behavior and compatibility with portals in React 17 @layershifter ([#16514](https://github.com/microsoft/fluentui/pull/16514))
- Fix `mergeVariablesOverrides` to return `variables` if it's defined and `overrides` are not @assuncaocharles ([#16560](https://github.com/microsoft/fluentui/pull/16560))
- Refactor `react-context-selector` to avoid React warnings @assuncaocharles ([#16714](https://github.com/microsoft/fluentui/pull/16714))
- Exclude className for CKEditor to avoid collisions with Fela renderer @layershifter ([#17025](https://github.com/microsoft/fluentui/pull/17025))
- Fix a memory leak in `useEventListener` @layershifter @miroslavstastny ([#16991](https://github.com/microsoft/fluentui/pull/16991))
- Remove `role='complementary'` from `popupBehavior` for inline popup @yuanboxue-amber ([#17032](https://github.com/microsoft/fluentui/pull/17032))

<!--------------------------------[ v0.52.0 ]------------------------------- -->
## [v0.52.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-northstar_v0.52.0) (2021-01-26)
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-northstar_v0.51.7..@fluentui/react-northstar_v0.52.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const buttonBehavior: Accessibility<ButtonBehaviorProps> = props => {
attributes: {
root: {
role: props.as === 'button' ? undefined : 'button',
tabIndex: props.as === 'button' ? undefined : 0,
tabIndex: props.as === 'button' || props.disabled ? undefined : 0,
disabled: props.disabled && !props.loading ? (props.as === 'button' ? true : undefined) : undefined,
'aria-disabled': props.disabled || props.loading,
'aria-disabled': props.disabledFocusable || props.loading,
},
},

Expand Down Expand Up @@ -37,5 +37,6 @@ export type ButtonBehaviorProps = {
as: string;
/** A button can show it is currently unable to be interacted with. */
disabled?: boolean;
disabledFocusable?: boolean;
loading?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IS_FOCUSABLE_ATTRIBUTE } from '../../attributes';
export const checkboxBehavior: Accessibility<CheckboxBehaviorProps> = props => ({
attributes: {
root: {
'aria-checked': !!props.checked,
'aria-checked': props.checked === 'mixed' ? 'mixed' : !!props.checked,
'aria-disabled': props.disabled,
role: 'checkbox',
tabIndex: 0,
Expand All @@ -31,7 +31,7 @@ export const checkboxBehavior: Accessibility<CheckboxBehaviorProps> = props => (

export type CheckboxBehaviorProps = {
/** Whether or not item is checked. */
checked?: boolean;
checked?: boolean | 'mixed';
/** If the checkbox is in disabled state. */
disabled?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { popupBehavior, PopupBehaviorProps } from '../Popup/popupBehavior';
* Implements ARIA [MenuButton](https://www.w3.org/TR/wai-aria-practices/#menubutton) design pattern.
*/
export const menuButtonBehavior: Accessibility<MenuButtonBehaviorProps> = props => {
const behavior = popupBehavior(props);
const behavior = popupBehavior({ ...props, inline: !props.contextMenu });

return _.merge(behavior, {
attributes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const popupBehavior: Accessibility<PopupBehaviorProps> = props => {
...tabbableTriggerProps,
},
popup: {
role: props.trapFocus ? 'dialog' : 'complementary',
role: props.trapFocus ? 'dialog' : props.inline ? undefined : 'complementary',
'aria-modal': props.trapFocus ? true : undefined,
},
},
Expand Down Expand Up @@ -112,4 +112,6 @@ export type PopupBehaviorProps = {
tabbableTrigger?: boolean;
/** Whether the popup was opened by right click */
isOpenedByRightClick?: boolean;
/** Whether the Popup should be rendered inline with the trigger or in the body. */
inline?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { buttonBehavior, ButtonBehaviorProps } from '../Button/buttonBehavior';
* @specification
* Adds role='button' if element type is other than 'button'. This allows screen readers to handle the component as a button.
* Adds attribute 'tabIndex=0' if element type is other than 'button'.
* Adds attribute 'aria-disabled=true' based on the property 'disabled'. This can be overriden by providing 'aria-disabled' property directly to the component.
* Adds attribute 'aria-haspopup=menu' to 'root' slot if 'hasMenu' property is set.
* Adds attribute 'aria-haspopup=dialog' to 'root' slot if 'hasPopup' property is set.
* Triggers 'performClick' action with 'Enter' or 'Spacebar' on 'root'.
Expand Down
Loading

0 comments on commit d645fc8

Please sign in to comment.