Skip to content

Commit

Permalink
removing focus ring on click
Browse files Browse the repository at this point in the history
update unrelease.md
  • Loading branch information
happykoder committed Mar 5, 2021
1 parent 96cd8e2 commit 9fad616
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f
- `IndexTable` Remove parent resource name from bulk select action ([#4013](https://github.com/Shopify/polaris-react/pull/4013))
- Ensured `@charset` declaration is the first thing in our styles.css file ([#4019](https://github.com/Shopify/polaris-react/pull/4019))
- Fix `Modal.Section` divider color to match header and footer divider ([#4021](https://github.com/Shopify/polaris-react/pull/4021))
- Remove focus ring on click for ActionList ([#4034](https://github.com/Shopify/polaris-react/pull/4034))

### Documentation

Expand Down
5 changes: 5 additions & 0 deletions src/components/ActionList/ActionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ $item-vertical-padding: ($item-min-height - line-height(body)) / 2;
margin-left: spacing();
}

.ContentBlock,
.ContentBlock span {
display: block;
}

.Text {
@include layout-flex-fix;
flex: 1 1 auto;
Expand Down
24 changes: 13 additions & 11 deletions src/components/ActionList/components/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {UnstyledLink} from '../../../UnstyledLink';
import {Badge} from '../../../Badge';
import {TextStyle} from '../../../TextStyle';
import styles from '../../ActionList.scss';
import {handleMouseUpByBlurring} from '../../../../utilities/focus';

export type ItemProps = ActionListItemDescriptor;

Expand Down Expand Up @@ -40,30 +41,30 @@ export function Item({
let prefixMarkup: React.ReactNode | null = null;

if (prefix) {
prefixMarkup = <div className={styles.Prefix}>{prefix}</div>;
prefixMarkup = <span className={styles.Prefix}>{prefix}</span>;
} else if (icon) {
prefixMarkup = (
<div className={styles.Prefix}>
<span className={styles.Prefix}>
<Icon source={icon} />
</div>
</span>
);
} else if (image) {
prefixMarkup = (
<div
<span
role="presentation"
className={styles.Prefix}
style={{backgroundImage: `url(${image}`}}
/>
></span>
);
}

const contentText = ellipsis && content ? `${content}…` : content;

const contentMarkup = helpText ? (
<div>
<div>{contentText}</div>
<span className={styles.ContentBlock}>
<span>{contentText}</span>
<TextStyle variation="subdued">{helpText}</TextStyle>
</div>
</span>
) : (
contentText
);
Expand All @@ -78,15 +79,15 @@ export function Item({
<span className={styles.Suffix}>{suffix}</span>
);

const textMarkup = <div className={styles.Text}>{contentMarkup}</div>;
const textMarkup = <span className={styles.Text}>{contentMarkup}</span>;

const contentElement = (
<div className={styles.Content}>
<span className={styles.Content}>
{prefixMarkup}
{textMarkup}
{badgeMarkup}
{suffixMarkup}
</div>
</span>
);

const scrollMarkup = active ? <Scrollable.ScrollTo /> : null;
Expand All @@ -110,6 +111,7 @@ export function Item({
disabled={disabled}
aria-label={accessibilityLabel}
onClick={onAction}
onMouseUp={handleMouseUpByBlurring}
>
{contentElement}
</button>
Expand Down

0 comments on commit 9fad616

Please sign in to comment.