Skip to content

Commit

Permalink
FocusZone: minor documentation cleanup. (microsoft#113)
Browse files Browse the repository at this point in the history
* Adding autoscroll utility and marquee selection.

* More fixes.

* Enables selection preservation even when items dematerialize.

* Math rounding tweak in auto scrolling.

* Updating small nits.

* Adding example page, improving props documentation, adding memoization to measures to improve performance.

* More performance improvements.

* Moving files to a more logical location.

* Missing an index change.

* Adding more best practices content.

* Updating documentation.

* Removing unnecessary call.

* Removing dir from html.

* Removing an unnecessary measure from autoscroll.

* Updating basic details list example to use marquee selection.

* With scrolltop fix (#3)

* With scrolltop fix.

* addressing lint issues

* Improving the example by removing the images.

* Removing the scroll monitoring and css tweaking from Fabric component, due to performance.

* Fixing issues related to safari support.

* Minor improvement to EventGroup.

* Lint fixes.

* Updates for PR comments.

* Fixing hovers.

* Updating checkbox to a cleaner contract. This is a breaking change for CheckBox!

* Updating comments.

* Minor pr updates.

* Feedback.

* Updating focuszone to have inputProps.

* Tweaks to documentation.

* Adding a class interface.
  • Loading branch information
dzearing authored Aug 11, 2016
1 parent da6823b commit a37ab03
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
7 changes: 4 additions & 3 deletions src/components/Checkbox/Checkbox.Props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export interface ICheckboxProps extends React.Props<Checkbox> {
onChange?: (ev?: React.FormEvent, isChecked?: boolean) => void;

/**
* Input props that will be mixed into the input element, *before* other props are applied. This allows you to extend
* the input element with additional attributes, such as data-automation-id needed for automation. Note that if you
* provide, for example, "disabled" as well as "inputProps.disabled", the former will take precedence of the later.
* Optional input props that will be mixed into the input element, *before* other props are applied. This allows
* you to extend the input element with additional attributes, such as data-automation-id needed for automation.
* Note that if you provide, for example, "disabled" as well as "inputProps.disabled", the former will take
* precedence over the later.
*/
inputProps?: React.Props<HTMLInputElement>;
}
2 changes: 1 addition & 1 deletion src/components/CommandBar/CommandBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class CommandBar extends React.Component<ICommandBarProps, ICommandBarSta
return (
<div className={ css('ms-CommandBar', className) } ref='commandBarRegion'>
{ searchBox }
<FocusZone direction={ FocusZoneDirection.horizontal } rootProps={ { role:'menubar' } }>
<FocusZone direction={ FocusZoneDirection.horizontal } rootProps={ { role: 'menubar' } }>
<div className='ms-CommandBar-primaryCommands' ref='commandSurface'>
{ renderedItems.map((item, index) => (
this._renderItemInCommandBar(item, index, expandedMenuItemKey)
Expand Down
6 changes: 2 additions & 4 deletions src/components/ContextualMenu/ContextualMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,11 @@ export class ContextualMenu extends React.Component<IContextualMenuProps, IConte
<div ref={ (host: HTMLDivElement) => this._host = host} id={ id } className={ css('ms-ContextualMenu-container', className) }>
{ (items && items.length) ? (
<FocusZone
className={ 'ms-ContextualMenu is-open' }
direction={ FocusZoneDirection.vertical }
ariaLabelledBy={ labelElementId }
ref={ (focusZone) => this._focusZone = focusZone }
rootProps={ {
className: 'ms-ContextualMenu is-open',
role: 'menu'
} }
rootProps={ { role: 'menu' } }
>
<ul className='ms-ContextualMenu-list is-open' onKeyDown={ this._onKeyDown }>
{ items.map((item, index) => (
Expand Down
28 changes: 20 additions & 8 deletions src/components/FocusZone/FocusZone.Props.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import * as React from 'react';
import { FocusZone } from './FocusZone';

/**
* FocusZone component class interface.
*/
export interface IFocusZone {
/** Sets focus to the checkbox. */
focus(): void;
}

/**
* FocusZone component props.
*/
export interface IFocusZoneProps extends React.Props<FocusZone> {
/**
* Additional class name to provide on the root element, in addition to the ms-FocusZone class.
*/
className?: string;

/**
* Defines which arrows to react to.
* @default FocusZoneDirection.bidriectional
Expand Down Expand Up @@ -39,14 +55,10 @@ export interface IFocusZoneProps extends React.Props<FocusZone> {
onActiveElementChanged?: (element?: HTMLElement, ev?: React.FocusEvent) => void;

/**
* If provided, additional class name to provide on the root element.
*/
className?: string;

/**
* If provided, HTMLProps which will be mixed in onto the root element emitted by the FocusZone, before
* other props are applied. This allows you to extend the root element with additional attributes, such as
* data-automation-id needed for automation.
* Optional DIV props that will be mixed into the root element, *before* other props are applied. This allows you
* to extend the root element with additional attributes, such as data-automation-id needed for automation. Note
* that if you provide, for example, "ariaLabelledBy" as well as "rootProps.ariaLabelledBy", the former will take
* precedence over the later.
*/
rootProps?: React.HTMLProps<HTMLDivElement>;
}
Expand Down
10 changes: 7 additions & 3 deletions src/components/FocusZone/FocusZone.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import * as React from 'react';
import { IFocusZoneProps, FocusZoneDirection } from './FocusZone.Props';
import {
FocusZoneDirection,
IFocusZone,
IFocusZoneProps
} from './FocusZone.Props';
import { EventGroup } from '../../utilities/eventGroup/EventGroup';
import { KeyCodes } from '../../utilities/KeyCodes';
import { getRTL } from '../../utilities/rtl';
Expand All @@ -26,7 +30,7 @@ interface IPoint {
top: number;
}

export class FocusZone extends React.Component<IFocusZoneProps, {}> {
export class FocusZone extends React.Component<IFocusZoneProps, {}> implements IFocusZone {

public static defaultProps: IFocusZoneProps = {
isCircularNavigation: false,
Expand Down Expand Up @@ -90,7 +94,7 @@ export class FocusZone extends React.Component<IFocusZoneProps, {}> {
return (
<div
{ ...rootProps }
className={ css('ms-FocusZone', className ) }
className={ css('ms-FocusZone', className) }
ref='root'
data-focuszone-id={ this._id }
aria-labelledby={ ariaLabelledBy }
Expand Down

0 comments on commit a37ab03

Please sign in to comment.