Skip to content

Commit

Permalink
fix(image-with-caption): adjust image button background color (#10279)
Browse files Browse the repository at this point in the history
### Related Ticket(s)

#10250
https://jsw.ibm.com/browse/ADCMS-3105

### Description

Sets the background style to transparent for the `<button>` element used in the shadow DOM of the `<dds-image>` and `<dds-image-with-caption>` components, such that when used with a transparent image (SVG, transparent gif/png), the browser's default button grey does not show through.

Note that the original issue was reported for `<dds-image-with-caption>`, but the issue equally effects `<dds-image>` component as well. Note also that the `<dds-image-with-caption>` button was recently deprecated, it's features merged with `<dds-image>`. Use of `<dds-image-with-caption>` should be replaced by `<dds-image>` (see #8839). The deprecation is documented in the [Storybook README for the Image component](https://carbon-design-system.github.io/carbon-for-ibm-dotcom/canary/web-components/?path=/docs/components-image--default#image-with-caption).

### Testing Instructions

- [ ] Open Storybook to the Image > Default component. 
- [ ] For the "Default image" Storybook knob, choose "SVG". A transparent SVG is used as the image for the component. 
- [ ] Select Lightbox as well from the Storybook knobs
- [ ] Note the browser default button color does not show through.

### Changelog

**Changed**

- Added `background-color: transparent` to the button styles for the `<dds-image>` component when in lightbox mode.
  • Loading branch information
m4olivei authored Apr 6, 2023
1 parent 7f49e0c commit 9155681
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2022
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -32,6 +32,7 @@
position: relative;
pointer-events: none;
border: none;
background-color: transparent;

&:hover {
// only have lightbox functionality on bigger breakpoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const copy = `Lorem ipsum *dolor* sit amet, consectetur adipiscing elit. Aenean
- list item 2a.a
`;

// TODO: Replace with <dds-image-with-caption>
const image = html`
<dds-image slot="media" alt="Image alt text" default-src="${imgLg16x9}">
<dds-image-item media="(min-width: 672px)" srcset="${imgLg16x9}">
Expand Down
Loading

0 comments on commit 9155681

Please sign in to comment.