Forum Discussion
Teams configurable tab disable remove button
setValidityState doesn't work correctly on tab removal page , if we set the setValidityState to false it gets enable after few seconds.
But for the save Button is working as expected.
in the documents it suggests setValidityState(false) works in same way for save and remove but that is not the case.
the version of the microsoft-teams-library-js is 1.10.0
- Meghana-MSFTMicrosoftWe are looking into this issue, We will update you.
- Meghana-MSFTMicrosoftCould you please share the document you are referring to? and also the repro steps.
- Umag98Brass Contributor
this is the link
https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/create-tab-pages/removal-page
import * as microsoftTeams from "@microsoft/teams-js";
import { initializeIcons } from "@fluentui/react";
import { Provider, Button, Segment, teamsTheme } from "@fluentui/react-northstar";
import React, { useEffect, useState } from 'react';
import { useTeams } from "msteams-react-base-component";
initializeIcons();
const Remove = () => {
const [{ context }] = useTeams({});
const[remove,setRemove]=useState(false);
useEffect(() => {
if (context) {
if(context.frameContext==="remove"){
setRemove(true);
microsoftTeams.settings.setValidityState(false);
microsoftTeams.settings.registerOnRemoveHandler((removeEvent) => {
microsoftTeams.settings.getSettings((settings) => {
settings.contentUrl = "https://localhost:8080/#/channel"
});
removeEvent.notifySuccess();
});
}
}
}, [context]);
return (
<Provider theme={teamsTheme}>
{remove && <>
<Segment content={
<>
<h3>Are You Sure, You Want To Remove The Tab</h3>
<h3>Click on Continue to Remove</h3>
<Button content="Continue" style={{ marginTop:"5%" ,marginLeft: "360px" }} primary onClick={()=>{microsoftTeams.settings.setValidityState(true)}}/>
</>}/>
</>}
</Provider>
)
}
export default Remove;
the Remove button gets enabled after few seconds. even when i dont click on the button- Meghana-MSFTMicrosoft
Umag98 - In the documentation it is mentioned that Teams enables the Remove button after five seconds.
Thanks,
Meghana----------------------------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.