Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] Turn off text truncation by default and raise fixed truncation limit #1656

Merged
merged 4 commits into from Oct 5, 2017

Conversation

tgreenwatts
Copy link
Contributor

  • Benefits: No more detecting truncation, which is expensive. Performance benefits
  • Drawbacks: A mix of little … and big …s, but I think this will be uncommon and the big … can change meaning from “contents don’t fit cell” to “contents are really big”, also an icon change will help
  • Drawbacks: Wrapped text no longer gets … of any sort (unless real big). I’m fine with this, it’s pretty common. Apps that wrap should also resizeByTallest
    -How we do it:
    — Change the default from detectTruncation to fixedTruncation
    — Choose sane default
    — Write good release notes

I may have missed spots

@cmslewis cmslewis changed the title Turn off text truncation by default and raise fixed truncation limit [Table] Turn off text truncation by default and raise fixed truncation limit Oct 3, 2017
Copy link
Contributor

@gscshoyru gscshoyru left a comment

Choose a reason for hiding this comment

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

This is a breaking change; we may want to modify the defaults, but we shouldn't do that until we hit a major release, so we can call it out without breaking semver.

@tgreenwatts
Copy link
Contributor Author

I believe this is a UX change, but no different than a UX change like adding reorder handles to the columns without an interaction bar - it's a change, but one we believe is better for everyone. This should not disrupt any users. We will call it out in release notes clearly so if anyone wants to opt in to detectTruncation they are welcome to.

Before:
before

After:
image

This column is too long for it's current width, but not so long that it can't reasonably be displayed, so we do not truncate.

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

Ok, I thought about this some more and it's a reasonable UX change to make if we have high conviction that the old UX was fairly broken (I think we do). As @tgreenwatts said, we'll call it out in release notes clearly.

@tgreenwatts
Copy link
Contributor Author

I played with this in the dev preview and think the default was a little too low, so up-ed it to 2000.

@blueprint-bot
Copy link

Actually fix lint

Preview: documentation | table
Coverage: core | datetime

@gscshoyru gscshoyru dismissed their stale review October 5, 2017 18:02

Removing concens

@@ -31,10 +31,11 @@ export interface IJSONFormatProps extends ITruncatedFormatProps {

export class JSONFormat extends React.Component<IJSONFormatProps, {}> {
public static defaultProps: IJSONFormatProps = {
detectTruncation: true,
detectTruncation: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can delete this line and fall back to the default props defined in TruncatedFormat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't this be true for showPopover as well? it's default here is showPopover: TruncatedPopoverMode.WHEN_TRUNCATED, which is the default

omitQuotesOnStrings: true,
showPopover: TruncatedPopoverMode.WHEN_TRUNCATED,
stringify: (obj: any) => JSON.stringify(obj, null, 2),
truncateLength: 2000,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

@@ -66,8 +66,8 @@ export interface ITruncatedFormatProps extends IProps {
/**
* Number of characters that are displayed before being truncated and appended with the
* `truncationSuffix` prop. A value of 0 will disable truncation. This prop is ignored if
* `detectTruncation` is `true`.
* @default 80
* `detectTruncation` is `false`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, should this have changed? See https://github.com/palantir/blueprint/pull/1656/files#diff-820e3fef53ee313553edff37ddbf4737R116. By that logic, we'll never refer to the truncateLength if detectTruncation is true.

our inevitable return to that prior state from which the vast
majority have never stirred?
`;
const str = createStringOfLength(TruncatedFormat.defaultProps.truncateLength + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Beau-tee-ful!

@@ -71,11 +57,11 @@ describe("Formats", () => {
majority have never stirred?
`;

const style = { height: "200px", position: "relative" };
const style = { height: "300px", width: "300px", position: "relative" };
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd love a comment here.

// fix the container's width and height to ensure this test passes
// regardless of the page's dimensions.

@tgreenwatts tgreenwatts merged commit ae31cc3 into master Oct 5, 2017
@cmslewis
Copy link
Contributor

cmslewis commented Oct 5, 2017

@tgreenwatts - Wait wait, did you see my requested changes? Would like to see those implemented before merging. Reverting.

cmslewis added a commit that referenced this pull request Oct 5, 2017
tgreenwatts pushed a commit that referenced this pull request Oct 5, 2017
@tgreenwatts tgreenwatts deleted the tgreen/fixed-truncation-default branch October 5, 2017 20:21
cmslewis pushed a commit that referenced this pull request Oct 5, 2017
* Follow up to #1656

* Remove redundant defaults
@cmslewis cmslewis mentioned this pull request Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants