Skip to content

Commit 698c14d

Browse files
manasmanoharactions-user
authored andcommitted
fix: safari clipboard copy issue (#482)
* fix: disable Tailwind preflight to resolve clipboard issues in Safari, add preflight CSS in custom.css, and fix icon scaling - Disables Tailwind's preflight to address clipboard functionality issues in Safari. - Adds custom CSS to compensate for the absence of preflight styles. - Adds `viewBox` attributes to two SVG icons to prevent them from being cut off after disabling preflight. - Remove extra margin from default Docusaurus styles on h3, fixing community section heading. Signed-off-by: manasmanohar <[email protected]> * fix: reset border-radius for images in table cells and disable Roboto Bold to prevent font fallback issues Signed-off-by: manasmanohar <[email protected]> --------- Signed-off-by: manasmanohar <[email protected]> Signed-off-by: Manas Manohar <[email protected]>
1 parent 6cb7492 commit 698c14d

File tree

3 files changed

+156
-4
lines changed

3 files changed

+156
-4
lines changed

src/components/Community.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export const Community = () => {
4646
>
4747
<svg
4848
fill="currentColor"
49+
// Hotfix: add viewBox to prevent icon from being cut off after tailwind preflight disabled
4950
className="h-12 w-12 flex-none text-red-500 "
50-
// Hotfix: Compensate for Tailwind preflight removal causing icon to be cropped
5151
viewBox="0 0 48 48"
5252
>
5353
<rect width="48" height="48" rx="12" />
@@ -96,8 +96,8 @@ export const Community = () => {
9696
>
9797
<svg
9898
fill="currentColor"
99+
// Hotfix: add viewBox to prevent icon from being cut off after tailwind preflight disabled
99100
className="h-12 w-12 flex-none text-black "
100-
// Hotfix: Compensate for Tailwind preflight removal causing icon to be cropped
101101
viewBox="0 0 48 48"
102102
>
103103
<rect width="48" height="48" rx="12" />

src/css/custom.css

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ footer svg {
333333
font-weight: 600;
334334
}
335335

336+
/* Reset margin bottom on h3 (refer docs community section li item heading) after disabling tailwind preflight. */
337+
h3{
338+
margin-bottom: 1px;
339+
}
340+
341+
/* Reset any border-radius applied to images inside <td> elements. (see os icons and cross and tick icons in table) */
342+
td img {
343+
border-radius: 0 !important;
344+
}
345+
336346
.related-read-link {
337347
margin-left: 7px;
338348
}
@@ -571,3 +581,144 @@ a[class="breadcrumbs__link"] {
571581
[data-theme="dark"] th {
572582
color: white;
573583
}
584+
585+
/* Hotfix: Manually add Tailwind preflight styles to fix clipboard issues in Safari.
586+
Using `preflight: true` caused style conflicts, so these styles are directly included here. */*,
587+
::before,
588+
::after {
589+
box-sizing: border-box;
590+
border-width: 0;
591+
border-style: solid;
592+
border-color: theme('borderColor.DEFAULT', currentColor);
593+
}
594+
595+
* {
596+
margin: 0;
597+
}
598+
599+
html {
600+
height: 100%;
601+
line-height: 1.5;
602+
-webkit-text-size-adjust: 100%;
603+
-moz-tab-size: 4;
604+
tab-size: 4;
605+
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif);
606+
}
607+
608+
body {
609+
height: 100%;
610+
line-height: inherit;
611+
}
612+
613+
img,
614+
video,
615+
canvas,
616+
audio,
617+
iframe,
618+
embed,
619+
object {
620+
display: block;
621+
vertical-align: middle;
622+
}
623+
624+
img,
625+
video {
626+
max-width: 100%;
627+
height: auto;
628+
}
629+
630+
input,
631+
button,
632+
textarea,
633+
select {
634+
font: inherit;
635+
color: inherit;
636+
}
637+
638+
p,
639+
h1,
640+
h2,
641+
h3,
642+
h4,
643+
h5,
644+
h6 {
645+
overflow-wrap: break-word;
646+
}
647+
648+
#root,
649+
#__next {
650+
isolation: isolate;
651+
}
652+
653+
html {
654+
-webkit-font-smoothing: antialiased;
655+
-moz-osx-font-smoothing: grayscale;
656+
}
657+
658+
button,
659+
[type='button'],
660+
[type='reset'],
661+
[type='submit'] {
662+
-webkit-appearance: button;
663+
background-color: transparent;
664+
background-image: none;
665+
}
666+
667+
:-moz-focusring {
668+
outline: auto;
669+
}
670+
671+
table {
672+
border-collapse: collapse;
673+
}
674+
675+
ol,
676+
ul,
677+
menu {
678+
list-style: none;
679+
margin: 0;
680+
padding: 0;
681+
}
682+
683+
:disabled {
684+
cursor: default;
685+
}
686+
687+
:focus-visible {
688+
outline: 2px solid theme('colors.blue.600', #2563eb);
689+
outline-offset: 2px;
690+
}
691+
692+
[type='number']::-webkit-inner-spin-button,
693+
[type='number']::-webkit-outer-spin-button {
694+
height: auto;
695+
}
696+
697+
hr {
698+
height: 0;
699+
color: inherit;
700+
border-top-width: 1px;
701+
}
702+
703+
abbr:where([title]) {
704+
text-decoration: underline dotted;
705+
}
706+
707+
h1,
708+
h2,
709+
h3,
710+
h4,
711+
h5,
712+
h6 {
713+
font-size: inherit;
714+
font-weight: inherit;
715+
}
716+
717+
a {
718+
color: inherit;
719+
text-decoration: inherit;
720+
}
721+
722+
textarea {
723+
resize: vertical;
724+
}

tailwind.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ module.exports = {
1313
"./src/pages/**/*.{js,ts,jsx,tsx}",
1414
"./src/theme/**/*.{js,ts,jsx,tsx}",
1515
],
16+
/* Hotfix: Disable Tailwind's preflight to resolve clipboard functionality issues in Safari */
1617
corePlugins: {
1718
preflight: false, // to use Docusaurus base styles
1819
// container: false, // use container style from docusaurus
1920
},
20-
// // important: "#tailwind", // incrementally adopt Tailwind by wrapping pages with <div id="tailwind"> </div>
21+
// important: "#tailwind", // incrementally adopt Tailwind by wrapping pages with <div id="tailwind"> </div>
2122
theme: {
2223
extend: {
2324
typography: {
@@ -102,7 +103,7 @@ module.exports = {
102103
},
103104
fontFamily: {
104105
light: ["Roboto Light", "sans"],
105-
// hotfix: Remove "Roboto Bold" to prevent fallback to "Times" font due to a potential CSS conflict.
106+
/* Disable Roboto Bold to prevent fallback to Times font for highlighted text in the right article index sidebar and h3 elements on the homepage */
106107
// bold: ["Roboto Bold", "sans"],
107108
},
108109
keyframes: {

0 commit comments

Comments
 (0)