Skip to content

Replace all static IDs with guid IDs #51

@basham

Description

@basham

Instead of declaring an ID and hoping that the ID is unique in the application, use guid IDs, to essentially guarantee their uniqueness. This is done in the Dialog component right now. Replicate the technique elsewhere.

componentWillMount: function() {
// Guarantee ids are unique.
this.setState({
contentId: !!this.props.message ? mixins.guid() : null,
titleId: !!this.props.title ? mixins.guid() : null
});
},
//
// Render methods
//
render: function() {
return (
<Overlay show={this.props.show}>
<section
aria-describedby={this.state.contentId}
aria-labelledby={this.state.titleId}
className="qn-Dialog"
role="alertdialog">
{this.renderTitle()}
{this.renderMessage()}
<div className="qn-Dialog-actions">
<button
className="qn-Dialog-action qn-Button"
onClick={this.handleConfirm}>
{this.props.confirmationButtonLabel || 'Okay'}
</button>
<button
className="qn-Dialog-action qn-Button"
onClick={this.handleCancel}>
{this.props.cancelButtonLabel || 'Cancel'}
</button>
</div>
</section>
</Overlay>
);
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions