This issue is currently not reproducible in ArcGIS Hub, based on the steps to reproduce provided in this defect.
Additional note: The ArcGIS Hub site's text card now supports a variety of Calcite Design System components, including adding a modal. Here is the documentation on calcite-modal which includes a sample script: https://developers.arcgis.com/calcite-design-system/components/modal/
Consider using the supported Calcite design components (https://doc.arcgis.com/en/hub/sites/add-text-and-images.htm#ESRI_SECTION1_3E6FBF82D17C476D9A7AA6F432E38CAA) in ArcGIS Hub for the best customization experience. If this issue continues after incorporating customization of the text card using the Calcite modal component, please contact Esri Support for further investigation.