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


8 Replies
We are looking into this issue, We will update you.
Could you please share the document you are referring to? and also the repro steps.

this is the link

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";


const Remove = () => {

const [{ context }] = useTeams({});

useEffect(() => {
if (context) {
microsoftTeams.settings.registerOnRemoveHandler((removeEvent) => {
microsoftTeams.settings.getSettings((settings) => {
settings.contentUrl = "https://localhost:8080/#/channel"
}, [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)}}/>
export default Remove;

the Remove button gets enabled after few seconds. even when i dont click on the button

@Umag98 - In the documentation it is mentioned that Teams enables the Remove button after five seconds.






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.

@Meghana-MSFT , it mentions if we wont set setValidity. but i have set it to false

but here it is mentioned that it can indicate the save is enabled or disabled. 



@Meghana-MSFT- Can't we handle the remove button similar to save button?

We are setting up this sample. We will update you.

@umag - We checked with the engineering team. This behavior is by design as they do not want to allow app developers to completely block the user from deleting a tab.





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.