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

NcModal doesn't respect nested Modal style #5228

Closed
Antreesy opened this issue Feb 9, 2024 · 0 comments · Fixed by #5244
Closed

NcModal doesn't respect nested Modal style #5228

Antreesy opened this issue Feb 9, 2024 · 0 comments · Fixed by #5244
Assignees
Labels
bug Something isn't working feature: modal Related to the modal component
Milestone

Comments

@Antreesy
Copy link
Contributor

Antreesy commented Feb 9, 2024

Requirements:

  • Some dialogs (app settings) require deeper functionality, where global dialog window may call smaller NcModal (example: Talk -> Conversation settings -> Advanced permissions)
  • Sometime it happens, that nested modal could be mounted behind the global one, if they're mounted in the same container ('body' or different)
  • Solution is to mount nested Modal inside the global one

Issue

If one NcModal is nested to another, some styles (size modal is confirmed) may fall through to the nested modal, breaking the size

Reproduciton

To reproduce on https://nextcloud-vue-components.netlify.app/#/Components/NcModal:

<template>
	<div>
		<NcButton @click="showModal">Show Modal with fields</NcButton>
		<NcModal
			v-if="modal"
			@close="closeModal"
			name="Name inside modal">
			<div id="first-modal-id" class="modal__content">
			<NcButton @click="showModal2">Show Modal</NcButton>
		  <NcModal v-if="modal2" container="#test" @close="closeModal2" size="small" class="emoji-modal">
              {{"NcModal container='#first-modal-id' size='small'" }}
		  </NcModal>
			</div>
		</NcModal>
	</div>
</template>
<script>
export default {
	data() {
		return {
			modal: false,
			modal2: false,
		}
	},
	methods: {
		showModal() {
			this.modal = true
		},
		closeModal() {
			this.modal = false
		},
		showModal2() {
			this.modal2 = true
		},
		closeModal2() {
			this.modal2 = false
		},
	}
}
</script>
<style>
#first-modal-id {
  height: 200px;
}
</style>
Expected Actual
image image

Possible solution:

use direct child selector: .modal-wrapper--normal > .modal-container

@Antreesy Antreesy added bug Something isn't working feature: modal Related to the modal component labels Feb 9, 2024
@Antreesy Antreesy added this to the 8.6.3 milestone Feb 9, 2024
@Antreesy Antreesy self-assigned this Feb 9, 2024
@susnux susnux modified the milestones: 8.6.3, 8.7.0 Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: modal Related to the modal component
Projects
None yet
2 participants