Skip to content

transitioning title attribute to render as tooltip, and adding readon…#4261

Merged
micahgodbolt merged 9 commits intomicrosoft:masterfrom
petdun2519:users/petdun/addReadonlyStateAndTooltipCommandBarItems
Mar 19, 2018
Merged

transitioning title attribute to render as tooltip, and adding readon…#4261
micahgodbolt merged 9 commits intomicrosoft:masterfrom
petdun2519:users/petdun/addReadonlyStateAndTooltipCommandBarItems

Conversation

@petdun2519
Copy link
Copy Markdown
Contributor

@petdun2519 petdun2519 commented Mar 13, 2018

Pull request checklist

  • Addresses an existing issue: Fixes #0000

Description of changes

Title attribute will now be rendered as tooltip, readonly state provided for command bar items

Focus areas to test

(optional)

@micahgodbolt
Copy link
Copy Markdown
Member

This is basically adding a "readOnly" mode to contextual menu items (and should therefore also be added to buttons). It addresses the idea that a button can be focusable, but not actionable (as opposed to disabled which is treated as not really even there). It would probably have the same styles as disabled (though some design review would probably be useful). @joschect, @betrue-final-final : Has this approach been talk about/mocked up recently?

</TooltipHost>
);
}
else if (tooltipContent) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this should be on the same line as the closing {


private _onItemClick(item: IContextualMenuItem): (ev: React.MouseEvent<HTMLButtonElement>) => void {
return (ev: React.MouseEvent<HTMLButtonElement>): void => {
if (item.readOnly) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is added to command bar, it should also be added to the contextualmenu click handler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joschect I added a comment on this prop that it's implementation is not supported by all components, like for contextualmenu and for button as micah as mentioned, then other teams can come in and add the functionality on these components as they need them. is that ok?

@joschect
Copy link
Copy Markdown
Contributor

joschect commented Mar 15, 2018

@micahgodbolt I'm a little hesitant about readonly being applied to non-input fields. Read only already has some connotation that the content could be editable. While in the case of buttons/clickable things you can't edit those.

@micahgodbolt
Copy link
Copy Markdown
Member

@joschect good point, readonly does already have a meaning in HTML. How about we just call it smoosh?

j/k

Regardless of the name, I think the state makes sense.

@petdun2519
Copy link
Copy Markdown
Contributor Author

@micahgodbolt so you want me to add this behavior to the button components also? @joschect how about, 'actionable'? because disabled is already taken unfortunately

@micahgodbolt
Copy link
Copy Markdown
Member

we usually want a Boolean prop to be false by default, so that changing it to true is the exception. I asked around on term ideas and one of my favorites was 'inactive'. Another was 'suppressed', or 'locked' (though locked seems like a specific reason for being inactive or suppressed).

@petdun2519
Copy link
Copy Markdown
Contributor Author

@micahgodbolt ok I will change this to inactive. But do I need to implement this in button or can it happen in a subsequent pr?

@micahgodbolt
Copy link
Copy Markdown
Member

If this is blocking you, then doing button later is okay. But that is technical debt that has to be cleaned up before you're able to move to the 6.0 CommandBar.

@petdun2519
Copy link
Copy Markdown
Contributor Author

@joschect I have made the edits you suggested

Copy link
Copy Markdown
Member

@micahgodbolt micahgodbolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review comment, otherwise its fine. I like inactive


let tooltipContent = '';

if (item.title) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this add a tooltip to every command bar item? Is that intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@micahgodbolt only if they provide a title attribute

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah title attribute, yup. gotcha. was thinking title was the text in the button.

@micahgodbolt micahgodbolt merged commit 1d69b5d into microsoft:master Mar 19, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants